Announcement Announcement Module
Collapse
No announcement yet.
jndi property as environment variable Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jndi property as environment variable

    I have an environment variable setup in my tomcat context file as

    Code:
    <Environment name="envName" value="local" type="java.lang.String" override="true"/>
    I am able to read this in my spring-context.xml file by

    Code:
    <context:property-placeholder location="classpath:app-${envName}.properties"/>
    This works fine but when I deploy the application in websphere I have the same variable defined as a jndi entry. So obviously it doesnt works anymore and spring is not able to find the property value. How can i retrieve a jndi based string value and use that in spring expressions to load the correct properties file.

    Thanks

  • #2
    I both tomcat and websphere it is a jndi variable/entry. However in Tomcat it is automatically available in java:comp/env in websphere it depends on where you defined it. In general you need to add a resource-ref in your web.xml to make it local for your app.

    Comment

    Working...
    X