[ https://issues.apache.org/jira/browse/ISIS-597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830624#comment-13830624 ]
Dan Haywood commented on ISIS-597: ---------------------------------- Hi Oscar, The post-construct (and now injection) gets done pretty early on; conceptually it's part of (or at least I've always thought of it as part of) the metamodel building phase. So there never was/hase been an IsisSession around to do this initialization. I'm not arguing that the current behaviour is "right", just how it is. Still, we do install fixtures during bootstrapping, so I think it ought to be possible to set up a session while running post-construct. I'll re-open this ticket and look at it in more detail. cheers Dan > Services still not injected when entering @PostConstruct methods on a Service > ----------------------------------------------------------------------------- > > Key: ISIS-597 > URL: https://issues.apache.org/jira/browse/ISIS-597 > Project: Isis > Issue Type: Improvement > Components: Core, Objectstore: JDO > Affects Versions: objectstore-jdo-1.3.0, core-1.3.0 > Reporter: Oscar Bou > Assignee: Dan Haywood > Fix For: objectstore-jdo-1.4.0, core-1.4.0 > > > Methods annotated with @PostConstruct are invoked before their objects being > injected. > Steps to reproduce: > As per [1], create a method on a service annotated with @PostConstruct, like > this one: > @PostConstruct > public void init(final Map<?, ?> props) { > server.setGlobal("eventOccurrences", this.eventOccurrences); > > } > .... > // {{ injected: EventOccurrences > private EventOccurrences eventOccurrences; > public final void injectEventOccurrences(final EventOccurrences > eventOccurrences) { > this.eventOccurrences = eventOccurrences; > } > // }} > The problem is that when the execution arrives to: > server.setGlobal("eventOccurrences", this.eventOccurrences); > this.eventOccurrences is still null... So it has not yet been injected (or > instantiated). > [1] http://isis.apache.org/core/services/initializing-services.html -- This message was sent by Atlassian JIRA (v6.1#6144)