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

Publishing PrePostTemplateDefaults creates circular dependency #14674

Closed
jzheaux opened this issue Mar 1, 2024 · 0 comments
Closed

Publishing PrePostTemplateDefaults creates circular dependency #14674

jzheaux opened this issue Mar 1, 2024 · 0 comments
Assignees
Labels
in: config An issue in spring-security-config type: bug A general bug
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Mar 1, 2024

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

@jzheaux jzheaux added in: config An issue in spring-security-config type: bug A general bug labels Mar 1, 2024
@jzheaux jzheaux self-assigned this Mar 1, 2024
@jzheaux jzheaux added this to the 6.3.0-M3 milestone Mar 1, 2024
@jzheaux jzheaux closed this as completed in bade66e Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: config An issue in spring-security-config type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant