在项目启动的时候总是报错“”org.apache.shiro.ehcache.CacheManager“”not found 

关于springboot集成shiro采坑记录

然而我确实注入了。

检查pom文件也没问题,后来看到SecurityManager和SessionManager  Bean猛然发现

关于springboot集成shiro采坑记录

关于springboot集成shiro采坑记录

CacheManager的Bean name为shiroCacheManager,结合springboot基础就明白了,springboot往容器注入Bean的时候默认对象的名字也就是以往xml文件里的id默认是方法名,也就是说我把创建CacheManager的方法名改成shiroCacheManager就好了,或者在@Bean注解里写上name属性shiroCacheManager,经测试改过之后项目正常启动。

以此记录使用springboot容易忽略的小问题

相关文章: