2 Replies Latest reply on Jan 16, 2009 12:54 AM by juhasiltanen

    Spring context per Action class?

    juhasiltanen

      I have a single applicationContext.xml file, where all spring/hibernate configurations are made. Basically, a collection of DAO beans.

      I have two services with 10 action references.

      Each action is configured in this manner:

       <action name="..." class="..."
       process="one, two">
       <property name="exceptionMethod" value="exceptionHandler" />
       <property name="springContextXml" value="applicationContext.xml" />
       </action>
      


      When I start up the ESB server the log displays this instantiation message for each action definition:

      ...
      INFO [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@179fc37]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1990e8c
      ...
      


      Why is there a separate spring context for each action (what have I configured wrong)?

      How to enable a single spring context for all of the actions (or one context per service)?

        • 1. Re: Spring context per Action class?
          beve

          Hi,

          Why is there a separate spring context for each action (what have I configured wrong)?

          AbstractSpringAction extends AbstractActionLifecycle and there will be a single instance processing all messages. There will be one instance for every action definition you have. But if you specify multiple comma separated process methods like in your example they will be processed by the same instance.

          How to enable a single spring context for all of the actions (or one context per service)?

          This is currently not possible but you can always create a feature request for something like this.

          regards,

          /Daniel




          • 2. Re: Spring context per Action class?
            juhasiltanen

            Ok, so for every action definition, there is a spring context.

            My hibernate and c3p0 connection pool is defined in that same spring context configuration file, does this mean, that there is a separate connection pool and hibernate session for every action definition?