Announcement Announcement Module
Collapse
No announcement yet.
using a <jee:jndi-lookup string inside an instance of PropertyPlaceholderConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • using a <jee:jndi-lookup string inside an instance of PropertyPlaceholderConfigurer

    Environment: Windows server 2003, Spring 3.0, Tomcat 6

    How can I use a JNDI property inside a PropertyPlaceholderConfigurer?

    Specifically, I'm using JNDI to look up a java.lang.String that represents a path to a property file needed by my webapp

    <jee:jndi-lookup id="mypropsfile1" jndi-name="myPropsFile1" resource-ref="true"/>
    <jee:jndi-lookup id="mypropsfile2" jndi-name="myPropsFile2" resource-ref="true"/>

    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
    <property name="locations">
    <array>
    <value>how to use mypropsfile1 here ??</value>
    <value>how to use mypropsfile2 here ??</value>
    </array>
    </property>
    </bean>

    My "jee:jndi-lookup"s are working AFAIK. My problem seems to be how to reference JNDI resources inside the tag pair

    Thanks in advance!
    Mark

  • #2
    I've never tried this. but why not just use <ref> tags instead of your <value> tags. <ref bean="mypropsfile1"/>

    Mark

    Comment


    • #3
      I had stumbled upon the following and it works:

      <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="locations">
      <list>
      <bean class="org.springframework.core.io.FileSystemResou rce">
      <constructor-arg>
      <jee:jndi-lookup id="props1" jndi-name="properties-1" resource-ref="true" />
      </constructor-arg>
      </bean>

      <bean class="org.springframework.core.io.FileSystemResou rce">
      <constructor-arg>
      <jee:jndi-lookup id="props2" jndi-name="properties-2" resource-ref="true" />
      </constructor-arg>
      </bean>
      </list>
      </property>
      </bean>




      Regarding your suggestion, I assume you mean I could do this?

      <jee:jndi-lookup id="props1" jndi-name="properties-1" resource-ref="true" />
      <jee:jndi-lookup id="props2" jndi-name="properties-2" resource-ref="true" />

      <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
      <property name="ignoreUnresolvablePlaceholders" value="true"/>
      <property name="locations">
      <list>
      <ref bean="props1"/>
      <ref bean="props2"/>
      </list>
      </property>
      </bean>

      Comment

      Working...
      X