Araki北音 2021-06-11 21:13 采纳率: 60%
浏览 1090
已结题

spring-boot整合shiro框架启动报错

借助shiro框架中的api对密码进行md5加密

启动报错

  • 写回答

1条回答 默认 最新

  • 小P聊技术 2021-06-11 22:27
    关注

    在很多SpringBoot项目中,common或者parent 做了shiro依赖,这样其他模块项目 总是提示 No bean of type 'org.apache.shiro.realm.Realm' found

    Action:

    Please create bean of type 'Realm' or add a shiro.ini in the root classpath (src/main/resources/shiro.ini) or in the META-INF folder (src/main/resources/META-INF/shiro.ini).

     

     

    其实就是SpringBoot自动加载机制,在

    shiro-spring-boot-starter 有默认配置。所以需要屏蔽shiro 
    @SpringBootApplication( 输入 ShiroAutoConfiguration 把出现的三个匹配的项目排除 就可以了
    @SpringBootApplication(exclude = {ShiroAnnotationProcessorAutoConfiguration.class, ShiroAutoConfiguration.class, ShiroBeanAutoConfiguration.class})
     
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?