isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GESCONSULTOR - Óscar Bou <>
Subject Services still not injected when entering @PostConstruct methods on a Service
Date Sun, 17 Nov 2013 16:15:12 GMT
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:

    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?




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message