0 Replies Latest reply on Apr 24, 2015 8:32 AM by cirix

    Double annotation in EJB and Rest endpoint

    cirix

      Hi my friends,

      pitching for my big blog about service discovery, I found something rather interesting:

       

      @Path("/mypath")

      @Singleton

      public MyTestEJBBean{

      @Inject MyService anInstance;

       

        @PostConstruct

         public void registerEndpointToZooKeeper(){

            System.out.println("Doing some zookeeper stuff here");

         }

        

         @Get

         @Produces("application/json")

          public void actionForGetEndpoint(){

            System.out.println("Something else happens here");

          }

      }

       

      now according to the EJB 3.1 spec the @PostConstruct should fire just after the injection of the service and invoked before the @Singleton setup the services. Unfortunately that doesn't seem to be the behaviour of WildflyAS 8.2.0.Final . Have you faced/wrote such an example?I can reproduce it easily. Please let me know your thoughts.