Skip to content

Commit f0460ce

Browse files
committed
Register JndiPropertySource by default in portlet environments
Issue: SPR-8038, SPR-8545, SPR-8490
1 parent 6db594c commit f0460ce

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/StandardPortletEnvironment.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
import org.springframework.core.env.MutablePropertySources;
2626
import org.springframework.core.env.PropertySource;
2727
import org.springframework.core.env.PropertySource.StubPropertySource;
28+
import org.springframework.jndi.JndiPropertySource;
2829
import org.springframework.web.context.support.StandardServletEnvironment;
2930

3031
/**
3132
* {@link Environment} implementation to be used by {@code Servlet}-based web
3233
* applications. All Portlet-related {@code ApplicationContext} classes initialize an instance
3334
* by default.
3435
*
35-
* <p>Contributes {@code ServletContext}-, {@code PortletContext}-, and
36-
* {@code PortletConfig}-based {@link PropertySource} instances. See the
36+
* <p>Contributes {@code ServletContext}, {@code PortletContext}, {@code PortletConfig}
37+
* and JNDI-based {@link PropertySource} instances. See the
3738
* {@link #customizePropertySources} method for details.
3839
*
3940
* @author Chris Beams
@@ -53,14 +54,16 @@ public class StandardPortletEnvironment extends StandardEnvironment {
5354
* Customize the set of property sources with those contributed by superclasses as
5455
* well as those appropriate for standard portlet-based environments:
5556
* <ul>
56-
* <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME}
57-
* <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME}
58-
* <li>{@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
57+
* <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME}
58+
* <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME}
59+
* <li>{@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
60+
* <li>{@linkplain StandardServletEnvironment#JNDI_PROPERTY_SOURCE_NAME "jndiProperties"}
5961
* </ul>
6062
* <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
6163
* take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
6264
* which takes precedence over those in {@linkplain
63-
* StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}.
65+
* StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
66+
* and so on.
6467
* <p>Properties in any of the above will take precedence over system properties and
6568
* environment variables contributed by the {@link StandardEnvironment} superclass.
6669
* <p>The property sources are added as stubs for now, and will be
@@ -79,6 +82,7 @@ protected void customizePropertySources(MutablePropertySources propertySources)
7982
propertySources.addLast(new StubPropertySource(PORTLET_CONFIG_PROPERTY_SOURCE_NAME));
8083
propertySources.addLast(new StubPropertySource(PORTLET_CONTEXT_PROPERTY_SOURCE_NAME));
8184
propertySources.addLast(new StubPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
85+
propertySources.addLast(new JndiPropertySource(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME));
8286
super.customizePropertySources(propertySources);
8387
}
8488
}

0 commit comments

Comments
 (0)