Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix conflicting bean names between @EnableWebSecurity and @EnableWebSocketSecurity #16113

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

ngocnhan-tran1996
Copy link
Contributor

I think we should change bean name or use @ConditionalOnMissingBean

Closes #16011

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 17, 2024
@ngocnhan-tran1996 ngocnhan-tran1996 changed the title Change bean name for WebSocketObservationConfiguration Change bean name for WebSocketObservationConfiguration and ReactiveObservationConfiguration.java Nov 18, 2024
@jzheaux jzheaux self-assigned this Nov 20, 2024
@jzheaux jzheaux added in: config An issue in spring-security-config type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 20, 2024
@jzheaux jzheaux added this to the 6.4.1 milestone Nov 20, 2024
@jzheaux
Copy link
Contributor

jzheaux commented Nov 20, 2024

Thanks, @ngocnhan-tran1996. Will you please squash your commits and include the needed Closes message at the end? It should look like this:

Resolve Observation Bean Name Collisions

Closes gh-16011

Since this became time-sensitive as we decided to release the fix today, I went ahead and took care of these items. Thanks again, @ngocnhan-tran1996, for the fix!

@jzheaux jzheaux changed the title Change bean name for WebSocketObservationConfiguration and ReactiveObservationConfiguration.java Fix conflicting bean names between @EnableWebSecurity and @EnableWebSocketSecurity Nov 20, 2024
@jzheaux jzheaux merged commit b896a74 into spring-projects:main Nov 20, 2024
6 checks passed
@ngocnhan-tran1996 ngocnhan-tran1996 deleted the gh-16011 branch November 23, 2024 04:33
@gncj
Copy link

gncj commented Dec 27, 2024

Even with the fix I'm getting error when moved tthe versions of spring boot to 3.4.1 and spring security to 6.4.2:


APPLICATION FAILED TO START


Description:

Parameter 0 of method setFilterChains in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a single bean, but 2 were found:
- objectPostProcessor: defined by method 'objectPostProcessor' in class path resource [org/springframework/security/config/annotation/configuration/ObjectPostProcessorConfiguration.class]
- webSocketAuthorizationManagerPostProcessor: defined by method 'webSocketAuthorizationManagerPostProcessor' in class path resource [org/springframework/security/config/annotation/web/socket/WebSocketObservationConfiguration.class]

This may be due to missing parameter name information

Action:

Consider marking one of the beans as @primary, updating the consumer to accept multiple beans, or using @qualifier to identify the bean that should be consumed

@ngocnhan-tran1996
Copy link
Contributor Author

@gncj

This PR was merged.

You can reach out #16299 or spring-projects/spring-framework#34119

Thanks

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
in: config An issue in spring-security-config type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix conflicting bean names between @EnableWebSecurity and @EnableWebSocketSecurity
4 participants