You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Simecsek Timothy <Ti...@nttdata.com> on 2015/04/01 19:29:00 UTC

Possibility to define order for invoking @PostConstruct

Hello,



I'm looking for a way to ensure initialization order for domain service annotated with @PostConstruct.



I have a self defined domain service for application settings that uses the one of isis enhanced with caching. During unit tests I found that always a other domain service is instantiated that uses my application settings domain service.



Class name for my application settings: SettingsClient

Dependent class name: HostSync



Is it dependent from the name or is there some annotation that I can use?



Thanks!

Timothy

______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.

Re: Possibility to define order for invoking @PostConstruct

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Timothy,

There's no feature in Isis that lets you define the order of
initialization, I'm afraid.

And because we are using the JEE @PostConstruct annotation [1], I suspect
that it is "bad form" to require some sort of ordering.

~~~
>From the description of your problem I'm not sure that ordering is what you
need; rather that it seems that there's some ambiguity in terms of having
two similar services being available.

In JEE the @Qualifier annotation can help with this, but unfortunately we
haven't yet implemented that in Isis.

A workaround might be to define a subinterface and ensure that only one of
your domain services implements that interface.  That might work.

Could you post some additional snippets of your code to see if we can
figure out a solution for you ?


Cheers
Dan


[1] http://docs.oracle.com/javaee/7/api/javax/annotation/PostConstruct.html



On 1 April 2015 at 18:29, Simecsek Timothy <Ti...@nttdata.com>
wrote:

> Hello,
>
>
>
> I'm looking for a way to ensure initialization order for domain service
> annotated with @PostConstruct.
>
>
>
> I have a self defined domain service for application settings that uses
> the one of isis enhanced with caching. During unit tests I found that
> always a other domain service is instantiated that uses my application
> settings domain service.
>
>
>
> Class name for my application settings: SettingsClient
>
> Dependent class name: HostSync
>
>
>
> Is it dependent from the name or is there some annotation that I can use?
>
>
>
> Thanks!
>
> Timothy
>
> ______________________________________________________________________
> Disclaimer: This email and any attachments are sent in strictest confidence
> for the sole use of the addressee and may contain legally privileged,
> confidential, and proprietary data. If you are not the intended recipient,
> please advise the sender by replying promptly to this email and then delete
> and destroy this email and any attachments without any further use, copying
> or forwarding.