Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

PostConstruct is out of order on different environment, what could cause this?

Avatar

Avatar
Validate 1
Level 2
prestonModOp
Level 2

Likes

3 likes

Total Posts

59 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
prestonModOp
Level 2

Likes

3 likes

Total Posts

59 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
prestonModOp
Level 2

16-04-2018

We have some code roughly like this.

A Base Page Component that contains has an html.jsp page that adapts the BaseTemplate Component

An Event Page Component that contains has an html.jsp page that adapts the EventTemplate Component

The Event Page Component extends the Base Page Component. The EventPage.java class extends the BasePage.java class.

Both the EventTemplate and BaseTemplate Component java classes have @PostConstruct annotated initialization methods named different things.

On my local environment the BaseTemplate.java postconstruct method fires and then the EventTemplate.java postconstruct method fires. As expected since I would expect the base class to initialize first and then the subclass to initialize second as it depends on data in the base class.

On our cloud environments they fire the other way around, though, since we upgraded from AEM 6.1 to 6.3. Because EventTemplate.java extends BaseTemplate.java I expect BaseTemplate.java to fire first as it contains, well, base level things that EventTemplate.java needs.

Any reason why this would happen in the reverse? I've looked for stray calls to adapt the BaseTemplate.java class. I've looked for circular dependencies. I don't know what I'm missing.