SPR-7477 - Added lazy-init attribute to jee namespace
This commit is contained in:
@@ -35,6 +35,7 @@ import org.springframework.jndi.JndiObjectFactoryBean;
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class JeeNamespaceHandlerTests {
|
||||
|
||||
@@ -129,6 +130,16 @@ public class JeeNamespaceHandlerTests {
|
||||
assertPropertyValue(beanDefinition, "cacheSessionBean", "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLazyInitJndiLookup() throws Exception {
|
||||
BeanDefinition definition = this.beanFactory.getMergedBeanDefinition("lazyDataSource");
|
||||
assertTrue(definition.isLazyInit());
|
||||
definition = this.beanFactory.getMergedBeanDefinition("lazyLocalBean");
|
||||
assertTrue(definition.isLazyInit());
|
||||
definition = this.beanFactory.getMergedBeanDefinition("lazyRemoteBean");
|
||||
assertTrue(definition.isLazyInit());
|
||||
}
|
||||
|
||||
private void assertPropertyValue(BeanDefinition beanDefinition, String propertyName, Object expectedValue) {
|
||||
assertEquals("Property '" + propertyName + "' incorrect",
|
||||
expectedValue, beanDefinition.getPropertyValues().getPropertyValue(propertyName).getValue());
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd"
|
||||
default-lazy-init="true">
|
||||
|
||||
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
@@ -67,5 +67,12 @@
|
||||
cache-session-bean="true">
|
||||
<jee:environment>foo=bar</jee:environment>
|
||||
</jee:remote-slsb>
|
||||
|
||||
<!-- Lazy beans Tests-->
|
||||
<jee:jndi-lookup id="lazyDataSource" jndi-name="jdbc/MyDataSource" lazy-init="true" />
|
||||
<jee:local-slsb id="lazyLocalBean" jndi-name="ejb/MyLocalBean"
|
||||
business-interface="org.springframework.beans.ITestBean" lazy-init="true" />
|
||||
<jee:remote-slsb id="lazyRemoteBean" jndi-name="ejb/MyRemoteBean"
|
||||
business-interface="org.springframework.beans.ITestBean" lazy-init="true" />
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user