[ https://issues.apache.org/jira/browse/ISIS-597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830789#comment-13830789 ]
Dan Haywood commented on ISIS-597: ---------------------------------- Hi Oscar, ok, I've pushed an update, so that the services are now initialized in a session/transaction. It wasn't too big a deal in the end. One thing to note is that if (as recommended) you are using the RegisterEntities service (to ensure that all @PersistenceCapable domain entities are eagerly registered with DataNucleus), then you probably should make sure this is initialized prior to any of your other domain services that actually do work. To do this, prefix the entry for RegisterEntities with a low digit, eg: isis.services = \ 0:org.apache.isis.objectstore.jdo.service.RegisterEntities,\ \ 10:dom.todo.ToDoItems,\ 20:app.ToDoItemAnalysis,\ dom.todo.ToDoItemContributions,\ app.ToDoItemAnalysisContributions,\ ... etc ... I'm gonna close this ticket once more, but re-open if there are issues. Cheers Dan PS: no, I don't think there are any alternatives in Isis to ensure the "server" is created at start-up. The MetaModelValidators do run as a check, but their intent is more to do with, well, the semantics of the metamodel. > 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)