Expand my Community achievements bar.

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

Avatar

Level 3

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.

0 Replies