[MAGNOLIA-6969] @javax.annotation.PostConstruct is a bit useless because it is called _before_ Node2Bean. Created: 06/Mar/17  Updated: 19/May/22

Status: Open
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Michiel Meeuwissen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

If I want to do something in a magnolia managed bean then I might want to some initialization. E.g. we extended info.magnolia.module.site.ConfiguredSite

Naively I put a @PostConstruct method on the extension.

Tough the method is called, every field (as in this instance even the name of the site) is still null, which makes it less then useful.

I would have expected that the method was called after the bean was completely constructed.



 Comments   
Comment by Roman Kovařík [ 19/May/22 ]

Hi mihxil,

 

sorry for a late response. I'm not aware of a Magnolia support for @PostConstruct, Magnolia calls public init() method though.

We sometimes use it to produce definitions app errors by throwing IAException from the method.

 

Hope that helps

Roman

Generated at Mon Feb 12 04:19:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.