Describe the bug Hello,SpringSecurity. Today, when I use SpringBoot:2.5.4 and SpringSecurity:5.5.2 to build SpringBootAdmin Server,I found a error!
To Reproduce Just a simple project with SpringBoot Initializr, add spring-security and spring-boot-admin-server in pom.xml, and copy a sample in Spring Boot Admin Reference Guide (codecentric.github.io), a error will occur when you start run the SpringBoot project.
Expected behavior
The error log is as follows:
The bean 'springSecurityFilterChain', defined in class path resource
[org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.class], could not be registered.
A bean with that name has already been defined in class path resource
[org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class] and overriding is disabled.
Sample You can find the sample in gezq0714 repository, The following links: gezq0714/spring-boot-2.5.4-demo: SpringSecurity5.5.2 with SpringBoot2.5.4 occur a error demo (github.com)
Comment From: marcusdacoregio
Hi, @gezq0714.
This error is happening because the spring-boot-admin-server from codecentric is using a reactive approach, while your application is Servlet-based. You can see in the log that the ReactiveManagementWebSecurityAutoConfiguration is trying to create the bean:
[org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.class], could not be registered.
Since you've defined the bean using a Servlet-approach, the beans collide, the reactive auto-configuration looks for a SecurityWebFilterChain instead of a SecurityFilterChain.
What I suggest is that you implement your application using the reactive approach or search for a Servlet-based spring-boot-admin-server.