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

Support for @Order on nested configuration classes [SPR-15384] #19947

Closed
spring-projects-issues opened this issue Mar 27, 2017 · 3 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 27, 2017

Stefan Fussenegger opened SPR-15384 and commented

ConfigurationClassParser adds member classes in the order they are returned by the ASM-based MetadataReader and ClassMetadata while no further ordering seems to be applied.

Members are returned - at least in my setup - in alphabetical order by ASM. I couldn't find any documentation though that would suggest that this is the expected behavior. It simply seems to be the order in which ASM reads member names form the class file (so this might be even depending on the compiler?)


Affects: 4.3.7

Reference URL: spring-attic/spring-framework-issues#152

Issue Links:

Referenced from: commits spring-attic/spring-framework-issues@4928f52, spring-attic/spring-framework-issues@d447102

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Apr 3, 2017

Juergen Hoeller commented

Let's narrow the focus of this ticket to @Order support on nested configuration classes, effectively as a follow-up to #17257. We support order annotations on explicitly registered/scanned top-level configuration classes already, just not on nested ones... However, for nested classes, we can only really apply the order locally within the containing class since the are conceptually only a part of their containing configuration class.

As for the runtime order of member classes, this seems to be consistent between Java reflection and ASM-read bytecode at least: It is always alphabetical by class name for me.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We locally support such nested configuration classes within their containing class now. Note that the order values are not "global" among all configuration classes but rather just matter for the local group of nested classes (as an alternative to the by-name default order) among themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants