Browse Source

RESOLVED - issue SPR-4783: Add name attribute to all namespaces that use AbstractBeanDefinitionParser and declare name= attribute (includes <lang:groovy.../>).

pull/23217/head
David Syer 15 years ago
parent
commit
dec2ca30c2
  1. 7
      org.springframework.context/src/main/resources/org/springframework/scripting/config/spring-lang-3.0.xsd
  2. 7
      org.springframework.context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java
  3. 0
      org.springframework.context/src/test/resources/org/springframework/scripting/config/TestBean.groovy
  4. 4
      org.springframework.context/src/test/resources/org/springframework/scripting/config/scriptingDefaultsTests.xml

7
org.springframework.context/src/main/resources/org/springframework/scripting/config/spring-lang-3.0.xsd

@ -87,6 +87,13 @@ @@ -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[

7
org.springframework.context/src/test/java/org/springframework/scripting/config/ScriptingDefaultsTests.java

@ -27,6 +27,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -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 { @@ -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");

0
org.springframework.context/src/test/java/org/springframework/scripting/config/TestBean.groovy → org.springframework.context/src/test/resources/org/springframework/scripting/config/TestBean.groovy

4
org.springframework.context/src/test/java/org/springframework/scripting/config/scriptingDefaultsTests.xml → org.springframework.context/src/test/resources/org/springframework/scripting/config/scriptingDefaultsTests.xml

@ -5,14 +5,14 @@ @@ -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"/>
Loading…
Cancel
Save