Class JndiPropertySource
- java.lang.Object
- org.springframework.core.env.PropertySource<JndiLocatorDelegate>
- org.springframework.jndi.JndiPropertySource
public class JndiPropertySource extends PropertySource<JndiLocatorDelegate>
PropertySourceimplementation that reads properties from an underlying SpringJndiLocatorDelegate.By default, the underlying
JndiLocatorDelegatewill be configured with its"resourceRef"property set totrue, meaning that names looked up will automatically be prefixed with "java:comp/env/" in alignment with published JNDI naming conventions. To override this setting or to change the prefix, manually configure aJndiLocatorDelegateand provide it to one of the constructors here that accepts it. The same applies when providing custom JNDI properties. These should be specified usingJndiAccessor.setJndiEnvironment(java.util.Properties)prior to construction of theJndiPropertySource.Note that
StandardServletEnvironmentincludes aJndiPropertySourceby default, and any customization of the underlyingJndiLocatorDelegatemay be performed within anApplicationContextInitializerorWebApplicationInitializer.- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
JndiLocatorDelegate,ApplicationContextInitializer,WebApplicationInitializer,StandardServletEnvironment
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource
PropertySource.StubPropertySource
Field Summary
Fields inherited from class org.springframework.core.env.PropertySource
logger, name, source
Constructor Summary
Constructors Constructor Description JndiPropertySource(String name)Create a newJndiPropertySourcewith the given name and aJndiLocatorDelegateconfigured to prefix any names with "java:comp/env/".JndiPropertySource(String name, JndiLocatorDelegate jndiLocator)Create a newJndiPropertySourcewith the given name and the givenJndiLocatorDelegate.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetProperty(String name)This implementation looks up and returns the value associated with the given name from the underlyingJndiLocatorDelegate.Methods inherited from class org.springframework.core.env.PropertySource
containsProperty, equals, getName, getSource, hashCode, named, toString
Constructor Detail
JndiPropertySource
public JndiPropertySource(