Springbootadmin与security冲突问题及解决
作者:wang18057
Springbootadmin与security冲突
最近在研究springbootadmin监控服务,springboot版本使用3.2.5,security使用6.4.0-SNAPSHOT,集成了springbootadmin后,
一直报错
Parameter 0 of method setFilterChains in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a single bean, but 2 were found:
- requestMappingHandlerMapping: defined by method 'requestMappingHandlerMapping' in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
- controllerEndpointHandlerMapping: defined by method 'controllerEndpointHandlerMapping' in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]This may be due to missing parameter name information
我用的springbootadmin
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!-- spring-boot-admin-client --> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>3.2.3</version> </dependency>
网上到处找了资料,说是actuator 中自带security,与另一个security冲突
使用了各种方法都不能解决,最后请教大神,在bean上指定名称即可。
解决
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。