提交 dec2ca30 编写于 作者: D David Syer

RESOLVED - issue SPR-4783: Add name attribute to all namespaces that use...

RESOLVED - issue SPR-4783: Add name attribute to all namespaces that use AbstractBeanDefinitionParser and declare name= attribute (includes <lang:groovy.../>).
上级 1a9599c8
......@@ -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[
......
......@@ -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");
......
......@@ -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"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册