Spring Cloud搭建時碰到的問題及解決辦法

一: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

相關文章
相關標籤/搜索