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:
David Syer 2009-10-27 15:22:36 +00:00
parent 1a9599c815
commit dec2ca30c2
4 changed files with 16 additions and 2 deletions

View File

@ -87,6 +87,13 @@
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="name" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of this scripted bean as an alias or replacement for the id.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="scope" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[

View File

@ -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");

View File

@ -5,14 +5,14 @@
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"
http://www.springframework.org/schema/lang/spring-lang-3.0.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="testBean" name="/url" 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"/>