6 Replies Latest reply on Oct 31, 2012 10:33 AM by Piotr Nowicki

    @Singleton / @Startup and <init-on-startup> priorities

    Piotr Nowicki Newbie



      I have a Singleton EJB which is by default starting with AS startup (it's annotated with @Startup):




      public class MyInit {



          void init() {

              System.out.println("=========== INITIALIZING! ===========");




      During my integration tests, I'd like to have the startup disabled, so I define the following ejb-jar.xml:


      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.1"


          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">









      However, during deployment, I can still see the '==== INITIALIZING ====' message which indicates that the Singleton is still marked as @Startup.


      Am I missing something here? I attach the ready-to-deploy exemplary application.




      Edit: forgot to mention that i'm working on JBoss 7.0.1