Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.4.0-RC1 - BeanDefinitionOverrideException: Invalid bean definition with name 'webAuthorizationManagerPostProcessor' #16011

Open
zyro23 opened this issue Oct 30, 2024 · 4 comments
Assignees
Labels
status: waiting-for-triage An issue we've not yet triaged type: bug A general bug

Comments

@zyro23
Copy link

zyro23 commented Oct 30, 2024

Describe the bug

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'webAuthorizationManagerPostProcessor', defined in class path resource [org/springframework/security/config/annotation/web/configuration/ObservationConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/config/annotation/web/socket/WebSocketObservationConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

the naming conflict is between:

To Reproduce

  • create an empty boot-3.4.0-RC1 app with spring-web, spring-security, spring-websocket
  • add spring-security-messaging as dependency
  • add @EnableWebSocketSecurity

Expected behavior

app starts

Sample

sample app will be referenced asap, thank you!

@zyro23 zyro23 added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Oct 30, 2024
zyro23 added a commit to zyro23/spring-security-16011 that referenced this issue Oct 30, 2024
add spring-security-messaging, @EnableWebSocketSecurity
@ngocnhan-tran1996
Copy link
Contributor

@zyro23

I add @EnableWebSocket to file *Application.java and app starts

@zyro23
Copy link
Author

zyro23 commented Oct 30, 2024

hmm.. just added @EnableWebSocket to DemoApplication from the sample app but still getting the same error?

(gradle-) cleaned the project, re-ran multiple times.

diff
Index: src/main/java/com/example/demo/DemoApplication.java
<+>UTF-8
===================================================================
diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java
--- a/src/main/java/com/example/demo/DemoApplication.java	(revision 3ff50e46fc8852dc867b458892b65cb98b01f9a5)
+++ b/src/main/java/com/example/demo/DemoApplication.java	(date 1730308768835)
@@ -3,7 +3,9 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.security.config.annotation.web.socket.EnableWebSocketSecurity;
+import org.springframework.web.socket.config.annotation.EnableWebSocket;
 
+@EnableWebSocket
 @EnableWebSocketSecurity
 @SpringBootApplication
 public class DemoApplication {
console out (same failure)
2024-10-30T18:19:58.219+01:00 ERROR 15800 --- [demo] [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'webAuthorizationManagerPostProcessor', defined in class path resource [org/springframework/security/config/annotation/web/configuration/ObservationConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/config/annotation/web/socket/WebSocketObservationConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

4 actionable tasks: 4 executed

FAILURE: Build failed with an exception.

to make sure this is not a "runs-on-my-machine" kinda issue:

@ngocnhan-tran1996
Copy link
Contributor

@zyro23

My bad, I work with wrong version, I confirm this version throws error

@kalgon
Copy link

kalgon commented Nov 16, 2024

Can this issue be investigated before the releases of spring-security 6.4.0 and spring-boot 3.4.0 scheduled for next week? This problem breaks applications using both web and web sockets stacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants