1 Reply Latest reply on Aug 1, 2007 4:55 AM by alesj

    customizing jndiName in @Spring

    sysuser1

      It seems that by default, if xyz-1.0-SNAPSHOT.ear is deployed, the jndiName of the "bean factory" is "xyz-1.0-SNAPSHOT".

      Is there an easy way to change this jndiName?

        • 1. Re: customizing jndiName in @Spring
          alesj

          Yes.


          Since we'd like to hot deploy many different Spring archives, each of them must be uniquely represented in our environment. For that purpose, JNDI will be used as a registry for these deployments. But where can we get our local JNDI name? By default, this JNDI name is obtained from the archive's file name: <name>.spring or <name>-spring.xml. But since it's also possible for each bean factory to have parent bean factory, there should be a way to define this parent's name too. This can be done in Spring's beans xml descriptor in description tag as shown in Listing 3.

          We are parsing this description tag and looking for a regular expression pattern of 'BeanFactory=(<name>)' and 'ParentBeanFactory=(<name>)' so see Listing 4.


          In xml code:
          <description>BeanFactory=(MyBFName)</description>