MarkerHub/vueblog

BUG!!!ShiroFilterFactoryBean导致Realm注入的xxService以及依赖xxService的Service事务失效

mingchiuli opened this issue · 0 comments

ShiroConfig中对ShiroFilterFactoryBean做了配置,而ShiroFilterFactoryBean实现了BeanPostProcessor接口,导致所有依赖AccountRealm的Service被提前初始化,递归初始化Service依赖的Service,无法受到Spring AOP的代理导致事务失效!!!

导致事务失效!!!

具体查看启动时Spring日志打印信息:

[org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:376] INFO - Bean 'userServiceImpl' of type [com.markerhub.service.impl.UserServiceImpl] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

BUG处理方法是在依赖的Service上加@lazy开启懒加载模式