一:springboot集成shiro时的相关问题处理redis
1.shiro集成进springboot时,必定要采起spring boot的写法进行集成,不要采用xml文件配置,不然会形成shiro中获取不到spring管理的beanspring
2.shiro中采用spring的@Value注解时,若是调用了LifecycleBeanPostProcessor,须要加static或者删除,不然不起做用,以下:springboot
/** * 不加static 会致使springboot Configuration 获取不到@value配置问题 * @return */ @Bean(name = "lifecycleBeanPostProcessor") @ConditionalOnMissingBean public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() { return new LifecycleBeanPostProcessor(); }
3.shiro集成redis时从redis获取session强转时报ClassCastException,本身转本身报的类型转换错误,主要是springboot中引入了 spring-boot-devtools形成,类加载器不一致引发错误(具体须要深刻了解)去掉便可解决问题session