Skip to content

Allow BeanDefinitionRegistryPostProcessor to register other BeanDefinitionRegistryPostProcessors [SPR-10630] #15258

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

Closed
spring-projects-issues opened this issue Jun 5, 2013 · 3 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jun 5, 2013

Phil Webb opened SPR-10630 and commented

See #12525, originally marked as WONTFIX but would be very useful for Spring Security


Issue Links:

Referenced from: commits bb971ce

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jun 6, 2013

Phil Webb commented

Juergen Hoeller,

What do you think of this idea and the pull request #299

I am not sure if the #12525 was marked as WONTFIX for a reason. Could this also be backported to 3.2.x?

/cc Chris Beams

@spring-projects-issues
Copy link
Collaborator Author

Rob Winch commented

Juergen Hoeller I'm not sure this is working properly, but please correct me if I am wrong. When using Javaconfig if I register a BeanDefinitionRegistryPostProcessor, the BeanDefinition does not appear to be populated (it exists but doesn't contain the metadata).

The Javadoc on BeanDefinitionRegistryPostProcessor's postProcessBeanDefinitionRegistry method states:

Modify the application context's internal bean definition registry after its standard initialization. All regular bean definitions will have been loaded, but no beans will have been instantiated yet. This allows for adding further bean definitions before the next post-processing phase kicks in.

My understanding is that since the beans have been loaded, then all the metadata should be present. Additionally, if I create a BeanDefinitionRegistryPostProcessor via XML the metadata for the BeanDefnition is populated properly.

I have created a small sample project to illustrate the problem at https://github.com/rwinch/spring-security-sample/tree/SPR-10630

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Rob, I'm afraid there is a misunderstanding here: We aren't ever populating the ConstructorArgumentValues part from @Bean methods. Instead, from the container's perspective, those methods are argument-less factory methods that just potentially happen to see some constructor invocation with arguments in the bytecode within their method body...

So this feature works as designed, even if it isn't metadata-compatible to its XML equivalent. There isn't much we can do about this since this is so inherent to the factory method mechanism.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants