spring-projects / spring-security

Spring Security
http://spring.io/projects/spring-security
Apache License 2.0
8.83k stars 5.9k forks source link

EnableMethodSecurity should publish only one bean of each AuthorizationAdvisor #15592

Closed jzheaux closed 3 months ago

jzheaux commented 3 months ago

@EnableMethodSecurity, and more specifically MethodSecurityAdvisorRegistrar registers each Spring Security method interceptor separately as an advisor. Currently, though, it duplicates the bean definition of each one, causing two instances of each AuthorizationAdvisor in the application context.

This causes some unexpected behavior for beans that would like to depend on the list of AuthorizationAdvisor instances, for example in the case of AuthorizationProxyConfiguration.