You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/11/21 13:24:35 UTC

[jira] [Commented] (ISIS-597) Services still not injected when entering @PostConstruct methods on a Service

    [ https://issues.apache.org/jira/browse/ISIS-597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13828869#comment-13828869 ] 

ASF subversion and git services commented on ISIS-597:
------------------------------------------------------

Commit e188eb81529298814d46efe26f7b7d11d1510617 in branch refs/heads/master from [~danhaywood]
[ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=e188eb8 ]

ISIS-597: use ServicesInjectorDefault to wire services prior to postconstruct

In addition, currently the DomainObjectContainer is built lazily, much later on,
by the PersistenceMechanism.  There doesn't really seem to be any good
reason for this.  So, moving this responsibility earlier.

In addition, since IsisSessionFactoryDefault did nothing other than delegate to
its superclass, IsisSessionFactoryAbstract, have collapsed this hierarchy.


> 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
>            Reporter: Oscar Bou
>            Assignee: Dan Haywood
>             Fix For: 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)