1.问题描述
Springboot整合shiro前,service里的@Cacheable、@Transactional等注解都正常使用。
整合shiro之后,UserRealm类里自动注入的service中的注解失效
2.使用@Lazy注解
*/
public class CustomRealm extends AuthorizingRealm {
@Autowired
@Lazy
private UserService userService;
/**
添加完后一切正常
参考文档
https://stackoverflow.com/questions/21512791/spring-service-with-cacheable-methods-gets-initialized-without-cache-when-autowi
spring注解之@Lazy注解
https://blog.51cto.com/4247649/2118337
https://www.cnblogs.com/liaojie970/p/9035491.html
网友评论