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

@PostConstruct order in inheritance hierarchy is wrong (or at least not intuitive) [SPR-6094] #10762

Closed
spring-projects-issues opened this issue Sep 9, 2009 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Joern Barthel opened SPR-6094 and commented

  • Define an abstract class Foo with an annotated init method.
  • Define a concrete class Bar with an annotated init method.
  • Define a bean instance of Bar.

After the bean instantiation the init method of Bar is called. Then the init method of Foo is called. This is probably the wrong way to do it since superclasses likely define/instantiate stuff children will depend on.


Affects: 2.5.6

Attachments:

Referenced from: commits d4c16e9

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I revisited the order of both @PostConstruct and @PreDestroy processing for 3.0 RC1: @PostConstruct is now being processed top-down (base class first), whereas @PreDestroy is getting processed bottom-up (subclass first).

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 RC1 milestone Jan 11, 2019
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: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants