环境
依赖 | 版本 |
spring-boot-dependencies | 2.7.6 |
shiro-spring-boot | 1.13.0 |
问题
项目启动报错
***************************
APPLICATION FAILED TO START
***************************
Description:
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).
Disconnected from the target VM, address: '127.0.0.1:52341', transport: 'socket'
Process finished with exit code 1
解决方式
排除掉ShiroConfig配置、注解、yml、依赖版本等问题后,尝试了网友们的方法,没有解决问题。
最终我的解决方式是使用shiro-spring替换shiro-spring-boot-web-starter依赖
<!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-spring-boot-web-starter -->
<!-- <dependency>-->
<!-- <groupId>org.apache.shiro</groupId>-->
<!-- <artifactId>shiro-spring-boot-web-starter</artifactId>-->
<!-- <version>${shiro-spring-boot.version}</version>-->
<!-- </dependency>-->
<!-- Shiro使用Spring框架 -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.13.0</version>
</dependency>