RESOLVED - issue SPR-4783: Add name attribute to all namespaces that use AbstractBeanDefinitionParser and declare name= attribute (includes <lang:groovy.../>).
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class ScriptingDefaultsTests extends TestCase {
|
||||
|
||||
@@ -51,6 +52,12 @@ public class ScriptingDefaultsTests extends TestCase {
|
||||
assertTrue(testBean.isInitialized());
|
||||
}
|
||||
|
||||
public void testNameAsAlias() {
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG);
|
||||
ITestBean testBean = (ITestBean) context.getBean("/url");
|
||||
assertTrue(testBean.isInitialized());
|
||||
}
|
||||
|
||||
public void testDefaultDestroyMethod() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(CONFIG);
|
||||
ITestBean testBean = (ITestBean) context.getBean("nonRefreshableTestBean");
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package org.springframework.scripting.config
|
||||
|
||||
class TestBean implements ITestBean {
|
||||
|
||||
ITestBean otherBean
|
||||
|
||||
boolean initialized
|
||||
|
||||
boolean destroyed
|
||||
|
||||
void setOtherBean(ITestBean otherBean) {
|
||||
this.otherBean = otherBean;
|
||||
}
|
||||
|
||||
void startup() { this.initialized = true }
|
||||
|
||||
void shutdown() { this.destroyed = true }
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:lang="http://www.springframework.org/schema/lang"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/lang
|
||||
http://www.springframework.org/schema/lang/spring-lang.xsd"
|
||||
default-autowire="byName"
|
||||
default-init-method="startup"
|
||||
default-destroy-method="shutdown">
|
||||
|
||||
<lang:defaults refresh-check-delay="5000"/>
|
||||
|
||||
<lang:groovy id="testBean" script-source="classpath:org/springframework/scripting/config/TestBean.groovy"/>
|
||||
|
||||
<lang:groovy id="nonRefreshableTestBean" refresh-check-delay="-1"
|
||||
script-source="classpath:org/springframework/scripting/config/TestBean.groovy"/>
|
||||
|
||||
<bean id="otherBean" class="org.springframework.scripting.config.OtherTestBean"/>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user