Closed
Description
When publishing PrePostTemplateDefaults
like so:
@Bean
PrePostTemplateDefaults templateDefaults() {
return new PrePostTemplateDefaults();
}
the advisor
counterparts to the method security method interceptors fail to be published due to a circular dependency:
2024-03-01T14:52:39.412-07:00 TRACE 3681326 --- [ Test worker] .a.f.a.BeanFactoryAdvisorRetrievalHelper : Skipping advisor 'preAuthorizeAuthorizationAdvisor' with dependency on currently created bean: Error creating bean with name 'preAuthorizeAuthorizationAdvisor' defined in class path resource [org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class]: Failed to instantiate [org.aopalliance.intercept.MethodInterceptor]: Factory method 'preAuthorizeAuthorizationMethodInterceptor' threw exception with message: Error creating bean with name 'templateDefaults': Requested bean is currently in creation: Is there an unresolvable circular reference?
Here is a sample that demonstrates the circular dependency: https://github.com/jzheaux/spring-security-samples/tree/gh-14674