Hi to all.
I have an Isis service that needs to initialize a "server" upon creation (it's
a Drools session, but it would be the same with an email server, for instance).
For initializing that "server", I need to pass it references to other Isis
services (in this case Drools globals).
If, as per [1], I try like this:
@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).
I must ensure that the server starts to run from the beginning of the Isis
application execution.
There's a note on [1] footer, but I thought this is not the case, as my only
expectation is that services are injected when calling "@PostConstruct" methods.
Perhaps I'm missing something basic or the previous expectation is precisely
the one explicited by the footer note ...
If that's the case, is there a better way to solve it?
Thanks,
Oscar
[1] http://isis.apache.org/core/services/initializing-services.html