You've already forked FrameTour-BE
refactor(auth): 延迟加载RedisTemplate和Mapper依赖
- 为RedisTemplate添加@Lazy注解实现延迟加载 - 为scenicAccountMapper添加@Lazy注解实现延迟加载 - 为adminUserMapper添加@Lazy注解实现延迟加载 - 避免应用启动时不必要的依赖初始化 - 提升系统启动性能和资源利用率
This commit is contained in:
@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Strings;
|
import org.apache.commons.lang3.Strings;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
@@ -41,10 +42,13 @@ import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
|||||||
@Component
|
@Component
|
||||||
public class AuthInterceptor implements HandlerInterceptor {
|
public class AuthInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisTemplate redisTemplate;
|
RedisTemplate redisTemplate;
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicAccountMapper scenicAccountMapper;
|
private ScenicAccountMapper scenicAccountMapper;
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminUserMapper adminUserMapper;
|
private AdminUserMapper adminUserMapper;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user