问题
Bean 'sysUserMapper' of type [org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
分析
多模块项目整合shiro启动时控制台提示,项目结构为admin为主模块,其他模块作为依赖引入主模块,大概情况是加载ShiroConfig时注册自定义UserRealm,顺便把引入的SysUserService注入了,容器注册Bean时发现已经存在了,导致Bean不符合BeanPostProcessors条件,打印出提示
了解Bean生命周期的小伙伴都清楚BeanPostProcessors在每个Bean初始化前和初始化后调用,这里由于SysUserService提前被注入导致无法进行后置增强(for example: not eligible for auto-proxying)不符合自动代理资格
解决方式
我解决的方法是在配置文件中引用的类加上@Lazy