Skip to content

InitDestroyAnnotationBeanPostProcessor is flipping the initialization order [SPR-6344] #11010

@spring-projects-issues

Description

@spring-projects-issues

Kenny MacLeod opened SPR-6344 and commented

As of RC1, the order in which bean init methods are being executed has been reversed, compared to the behaviour in 2.5.6 and M4.

Specifically, InitDestroyAnnotationBeanPostProcessor.LifecycleMetadata.addInitMethod is now adding each successive init method to the front of the list. Prior versions added it to the end.

This manifests itself as a problem in code where there are multiple init methods (e.g. multiple @PostConstruct methods) in one class. We have code where we're relying on those methods being executed in order, as returned by the reflection API. If there's executed in reverse order, it all breaks.

Is there a reason these methods are being explicitly reversed?


Affects: 3.0 RC1, 3.0 RC2

Referenced from: commits 3b9605b

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions