Results 1 to 5 of 5

Thread: Loading Spring Beans at startup during EJB 3.0 Deployemnt.

  1. #1
    Join Date
    Jul 2008
    Posts
    10

    Default Loading Spring Beans at startup during EJB 3.0 Deployemnt.

    Hi All,

    Presently I am using Spring 2.5 and EJB 3.0. I am able to wire my spring beans to EJB via using beanRefContext.xml and the using the following code snippet inside.

    Code:
    <bean id="factoryKey" class="org.springframework.context.support.ClassPathXmlApplicationContext" lazy-init="false">
                <constructor-arg type="java.lang.String" value="classpath:/META-INF/context/application.xml" />
            </bean>
    Now My Doubt or rather the issue is. How to load the spring beans at deployment time itself ? This is required because i am facing problem while trying to start a cron schduler. The scheduler is not loaded at deployment time.

    Is there any clean way to load spring beans at deployment time ( during the time, when the application is started in the server ) ?


    Thanks is advance.

    Regards
    Vasu Patnaik.

  2. #2
    Join Date
    May 2009
    Posts
    2

    Default Hi Bro!

    Hi
    I am also facing the same issue brother.. Did you get any solution for this?

    Please reply me ASAP....

    Thanks
    Sreedhar

  3. #3
    Join Date
    Jul 2008
    Posts
    10

    Default

    Hi Sridhar,

    Nope, I am not able to find a clean solution yet. What i did was, seperated out the cron job related beans in one xml file and programtically loaded the beans ( i know it is akward ) from the constructor of the ejb. ( at deployment time instance of the bean is being created ). this is kind of work-aroud for now.


    regards
    vasu

  4. #4
    Join Date
    May 2009
    Posts
    2

    Default Hello Vasu!!!

    Thanks for the reply vasu...

    I will try your solution.. But will the constructor of EJB called during the server startup? i hope the whole spring configuration will be loaded after first request only... Correct me if i am wrong... If possible please share your sample code. My mail id "tomailsree@gmail.com".

    For the time being I have created a simple servlet to load the cron job configuration in init() method.

    Thanks
    Sreedhar

  5. #5
    Join Date
    Jul 2008
    Posts
    10

    Default

    Hi Sridhar,

    Yes, At deployment time, instances of the deployed EJB's are created in GlassFIsh by default setting up the container specific transaction attributes.

    Regards
    Vasu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •