Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-597

Services still not injected when entering @PostConstruct methods on a Service

    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        Activity

          People

            danhaywood Daniel Keir Haywood
            oscarbou Óscar Bou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: