<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=pierreb" rel="nofollow">Pierre Bittner</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-978?redirect=false" rel="nofollow">SPR-978</a></strong>* and commented</p>
<p dir="auto">We need a configurer that resolves placeholder as application's environment entries.</p>
<p dir="auto">Our application is deployed on different environments (development, integration, production) and even in production we have the same application deployed many times.</p>
<p dir="auto">We must build different web archives just to change few properties (mail server, reporting server, etc.).</p>
<p dir="auto">In a J2EE application, such properties should be configured in application's environment entries (JNDI).</p>
<p dir="auto">I'll attached a proposal for an EnvironmentEntryPropertyPlaceholderConfigurer.</p>
<p dir="auto">See this thread for more infos:<br>
<a href="http://forum.springframework.org/viewtopic.php?t=5196" rel="nofollow">http://forum.springframework.org/viewtopic.php?t=5196</a></p>
<hr>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/10742/EnvironmentEntryPropertyPlaceholderConfigurer.java" rel="nofollow">EnvironmentEntryPropertyPlaceholderConfigurer.java</a> (<em>5.72 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/10743/EnvironmentEntryPropertyPlaceholderConfigurerTests.java" rel="nofollow">EnvironmentEntryPropertyPlaceholderConfigurerTests.java</a> (<em>4.22 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398074486" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7716" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7716/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7716">#7716</a> JNDI Property Placeholder Configurer (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=arthur.branham@morganstanley.com" rel="nofollow">Arthur</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3030?redirect=false" rel="nofollow">SPR-3030</a></strong> and commented</p>
<p dir="auto">When creating beans such as a JNDITemplate it is often desireable to have a container supply the provider URL and other configuration options via Environment entries.  I find it is generally not a great idea swap applicationContext files using a build script because it adds another layer of complexitity to the build process.  Therefore I prefer having different deployment descriptors on different test/production servers with different Environment settings.  The real benefit comes with the ability for certain containers to update these Environment entries during runtime such as if a provider URL becomes inaccessible.  I propose a JNDI Property Placehold Configurer which will do java:comp/env/ lookups to fill in the appropriate property values.</p>
<p dir="auto">Example usage would be as follows:</p>
<p dir="auto">&lt;bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"&gt;<br>
&lt;constructor-arg index="0"&gt;<br>
&lt;props&gt;<br>
&lt;prop key="java.naming.factory.initial"&gt;${java.naming.factory.initial}&lt;/prop&gt;<br>
&lt;prop key="java.naming.provider.url"&gt;${java.naming.provider.url}&lt;/prop&gt;<br>
&lt;prop key="java.naming.factory.url.pkgs"&gt;${java.naming.factory.url.pkgs}&lt;/prop&gt;<br>
&lt;/props&gt;<br>
&lt;/constructor-arg&gt;<br>
&lt;/bean&gt;<br>
I will attach a working version I have been using for several months now.</p>
<hr>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/15611/JndiAwarePropertyPlaceholderConfigurer.zip" rel="nofollow">JndiAwarePropertyPlaceholderConfigurer.zip</a> (<em>2.82 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/12492/JndiPropertiesFactoryBean.java" rel="nofollow">JndiPropertiesFactoryBean.java</a> (<em>4.47 kB</em>)</li>
<li><a href="https://jira.spring.io/secure/attachment/12333/JndiPropertyPlaceholderConfigurer.java" rel="nofollow">JndiPropertyPlaceholderConfigurer.java</a> (<em>7.98 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398057073" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5690" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5690/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5690">#5690</a> Configurer that resolves placeholders as environment entries (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398110685" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12693" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12693/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12693">#12693</a> Register JndiPropertySource by default in StandardPortletEnvironment</li>
</ul>
<p dir="auto">10 votes, 6 watchers</p>