Browse Source
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:
git merge -s recursive -Xtheirs --no-commit env
No merge conflicts, but did need to
git rm spring-build
prior to committing.
With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch. 3.1.0 snapshots will be available
per the usual nightly CI build from trunk.
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3782 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
211 changed files with 9868 additions and 615 deletions
@ -1,7 +1,11 @@
@@ -1,7 +1,11 @@
|
||||
target |
||||
integration-repo |
||||
ivy-cache |
||||
spring-build |
||||
jmx.log |
||||
.springBeans |
||||
.DS_Store |
||||
*.sw* |
||||
org.springframework.test/test-output/ |
||||
build.sh |
||||
org.springframework.beans/.settings/org.springframework.ide.eclipse.beans.core.prefs |
||||
org.springframework.beans/.settings/org.springframework.ide.eclipse.core.prefs |
||||
|
||||
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
||||
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd |
||||
http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd |
||||
http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd |
||||
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd |
||||
http\://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd |
||||
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.1.xsd |
||||
|
||||
@ -0,0 +1,407 @@
@@ -0,0 +1,407 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/aop" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/aop" |
||||
elementFormDefault="qualified" |
||||
attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the configuration elements for the Spring Framework's AOP support. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:element name="config"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A section (compartmentalization) of AOP-specific configuration (including |
||||
aspects, pointcuts, etc). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="pointcut" type="pointcutType" minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A named pointcut definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="advisor" type="advisorType" minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.aop.Advisor"><![CDATA[ |
||||
A named advisor definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="aspect" type="aspectType" minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A named aspect definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="proxy-target-class" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Are class-based (CGLIB) proxies to be created? By default, standard |
||||
Java interface-based proxies are created. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expose-proxy" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicate that the proxy should be exposed by the AOP framework as a |
||||
ThreadLocal for retrieval via the AopContext class. Off by default, |
||||
i.e. no guarantees that AopContext access will work. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="aspectj-autoproxy"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"><![CDATA[ |
||||
Enables the use of the @AspectJ style of Spring AOP. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="include" type="includeType" minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates that only @AspectJ beans with names matched by the (regex) |
||||
pattern will be considered as defining aspects to use for Spring autoproxying. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="proxy-target-class" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Are class-based (CGLIB) proxies to be created? By default, standard |
||||
Java interface-based proxies are created. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expose-proxy" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicate that the proxy should be exposed by the AOP framework as a |
||||
ThreadLocal for retrieval via the AopContext class. Off by default, |
||||
i.e. no guarantees that AopContext access will work. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="scoped-proxy"> |
||||
<xsd:complexType> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.aop.scope.ScopedProxyFactoryBean"><![CDATA[ |
||||
Marks a bean definition as being a scoped proxy. |
||||
|
||||
A bean marked as such will be exposed via a proxy, with the 'real' |
||||
bean instance being retrieved from some other source (such as a |
||||
HttpSession) as and when required. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:attribute name="proxy-target-class" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Are class-based (CGLIB) proxies to be created? This is the default; in order to |
||||
switch to standard Java interface-based proxies, turn this flag to "false". |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:complexType name="aspectType"> |
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:element name="pointcut" type="pointcutType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A named pointcut definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="declare-parents" type="declareParentsType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Allows this aspect to introduce additional interfaces that the advised |
||||
object will transparently implement. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="before" type="basicAdviceType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A before advice definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="after" type="basicAdviceType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An after advice definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="after-returning" type="afterReturningAdviceType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An after-returning advice definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="after-throwing" type="afterThrowingAdviceType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An after-throwing advice definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="around" type="basicAdviceType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An around advice definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
<xsd:attribute name="id" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The unique identifier for an aspect. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="ref" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of the (backing) bean that encapsulates the aspect. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="order" type="xsd:int"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.core.Ordered"><![CDATA[ |
||||
Controls the ordering of the execution of this aspect when multiple |
||||
advice executes at a specific joinpoint. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="includeType"> |
||||
<xsd:attribute name="name" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.util.regex.Pattern"><![CDATA[ |
||||
The regular expression defining which beans are to be included in the |
||||
list of @AspectJ beans; beans with names matched by the pattern will |
||||
be included. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="pointcutType"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="org.springframework.aop.Pointcut"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:attribute name="id" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The unique identifier for a pointcut. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expression" use="required" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The pointcut expression. |
||||
|
||||
For example : 'execution(* com.xyz.myapp.service.*.*(..))' |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="declareParentsType"> |
||||
<xsd:attribute name="types-matching" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.aop.aspectj.TypePatternClassFilter"><![CDATA[ |
||||
The AspectJ type expression that defines what types (classes) the |
||||
introduction is restricted to. |
||||
|
||||
An example would be 'org.springframework.beans.ITestBean+'. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="implement-interface" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The fully qualified name of the interface that will be introduced. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="default-impl" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The fully qualified name of the class that will be instantiated to serve |
||||
as the default implementation of the introduced interface. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="delegate-ref" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A reference to the bean that will serve |
||||
as the default implementation of the introduced interface. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"/> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="basicAdviceType"> |
||||
<xsd:attribute name="pointcut" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The associated pointcut expression. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="pointcut-ref" type="pointcutRefType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of an associated pointcut definition. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"> |
||||
<tool:expected-type type="org.springframework.aop.Pointcut"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="method" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of the method that defines the logic of the advice. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="arg-names" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The comma-delimited list of advice method argument (parameter) names |
||||
that will be matched from pointcut parameters. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="afterReturningAdviceType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="basicAdviceType"> |
||||
<xsd:attribute name="returning" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of the method parameter to which the return value must |
||||
be passed. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="afterThrowingAdviceType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="basicAdviceType"> |
||||
<xsd:attribute name="throwing" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of the method parameter to which the thrown exception must |
||||
be passed. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="advisorType"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="org.springframework.aop.Advisor"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="advice-ref" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A reference to an advice bean. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"> |
||||
<tool:expected-type type="org.aopalliance.aop.Advice"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="pointcut" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A pointcut expression. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="pointcut-ref" type="pointcutRefType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A reference to a pointcut definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="order" type="xsd:int"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.core.Ordered"><![CDATA[ |
||||
Controls the ordering of the execution of this advice when multiple |
||||
advice executes at a specific joinpoint. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:simpleType name="pointcutRefType"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"> |
||||
<tool:expected-type type="org.springframework.aop.Pointcut"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:union memberTypes="xsd:string"/> |
||||
</xsd:simpleType> |
||||
|
||||
</xsd:schema> |
||||
@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
|
||||
#Wed Jul 15 00:01:30 PDT 2009 |
||||
eclipse.preferences.version=1 |
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 |
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 |
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
||||
org.eclipse.jdt.core.compiler.compliance=1.6 |
||||
org.eclipse.jdt.core.compiler.compliance=1.5 |
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate |
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate |
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate |
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
||||
org.eclipse.jdt.core.compiler.source=1.6 |
||||
org.eclipse.jdt.core.compiler.source=1.5 |
||||
|
||||
@ -1,90 +1,84 @@
@@ -1,90 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-aspects</artifactId> |
||||
<packaging>jar</packaging> |
||||
<version>3.0.5.BUILD-SNAPSHOT</version> |
||||
<parent> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-parent</artifactId> |
||||
<relativePath>../org.springframework.spring-parent</relativePath> |
||||
<version>3.0.5.BUILD-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<dependencies> |
||||
<!-- commons logging dependency is in spring-core --> |
||||
<dependency> |
||||
<groupId>org.aspectj</groupId> |
||||
<artifactId>aspectjweaver</artifactId> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-beans</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-tx</artifactId> |
||||
<version>${project.version}</version> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-orm</artifactId> |
||||
<version>${project.version}</version> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context-support</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-test</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.persistence</groupId> |
||||
<artifactId>persistence-api</artifactId> |
||||
<version>1.0</version> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.mail</groupId> |
||||
<artifactId>mail</artifactId> |
||||
<version>1.4</version> |
||||
<scope>test</scope> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<pluginManagement> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-surefire-plugin</artifactId> |
||||
<configuration> |
||||
<junitArtifactName>junit:junit</junitArtifactName> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</pluginManagement> |
||||
</build> |
||||
</project> |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-aspects</artifactId> |
||||
<packaging>jar</packaging> |
||||
<version>3.1.0.BUILD-SNAPSHOT</version> |
||||
<parent> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-parent</artifactId> |
||||
<relativePath>../org.springframework.spring-parent</relativePath> |
||||
<version>3.1.0.BUILD-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<dependencies> |
||||
<!-- common logging dependency is in spring-core --> |
||||
<dependency> |
||||
<groupId>org.aspectj</groupId> |
||||
<artifactId>aspectjweaver</artifactId> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-beans</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-tx</artifactId> |
||||
<version>${project.version}</version> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-context-support</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework</groupId> |
||||
<artifactId>spring-test</artifactId> |
||||
<version>${project.version}</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.persistence</groupId> |
||||
<artifactId>persistence-api</artifactId> |
||||
<version>1.0</version> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>junit</groupId> |
||||
<artifactId>junit</artifactId> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>javax.mail</groupId> |
||||
<artifactId>mail</artifactId> |
||||
<version>1.4</version> |
||||
<scope>test</scope> |
||||
<optional>true</optional> |
||||
</dependency> |
||||
</dependencies> |
||||
<build> |
||||
<pluginManagement> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-surefire-plugin</artifactId> |
||||
<configuration> |
||||
<junitArtifactName>junit:junit</junitArtifactName> |
||||
</configuration> |
||||
</plugin> |
||||
</plugins> |
||||
</pluginManagement> |
||||
</build> |
||||
</project> |
||||
|
||||
@ -0,0 +1,191 @@
@@ -0,0 +1,191 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.beans.factory.config; |
||||
|
||||
import java.util.Properties; |
||||
|
||||
import org.springframework.beans.BeansException; |
||||
import org.springframework.beans.factory.BeanDefinitionStoreException; |
||||
import org.springframework.beans.factory.BeanFactory; |
||||
import org.springframework.beans.factory.BeanFactoryAware; |
||||
import org.springframework.beans.factory.BeanNameAware; |
||||
import org.springframework.util.PropertyPlaceholderHelper; |
||||
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; |
||||
import org.springframework.util.StringValueResolver; |
||||
|
||||
|
||||
/** |
||||
* TODO SPR-7508: document. |
||||
* |
||||
* @author Chris Beams |
||||
* @author Juergen Hoeller |
||||
* @since 3.1 |
||||
*/ |
||||
public abstract class AbstractPropertyPlaceholderConfigurer extends PropertyResourceConfigurer |
||||
implements BeanNameAware, BeanFactoryAware { |
||||
|
||||
/** Default placeholder prefix: "${" */ |
||||
public static final String DEFAULT_PLACEHOLDER_PREFIX = "${"; |
||||
/** Default placeholder suffix: "}" */ |
||||
public static final String DEFAULT_PLACEHOLDER_SUFFIX = "}"; |
||||
/** Default value separator: ":" */ |
||||
public static final String DEFAULT_VALUE_SEPARATOR = ":"; |
||||
|
||||
protected String placeholderPrefix = DEFAULT_PLACEHOLDER_PREFIX; |
||||
|
||||
protected String placeholderSuffix = DEFAULT_PLACEHOLDER_SUFFIX; |
||||
|
||||
protected String valueSeparator = DEFAULT_VALUE_SEPARATOR; |
||||
|
||||
protected boolean ignoreUnresolvablePlaceholders = false; |
||||
|
||||
private String nullValue; |
||||
|
||||
private String beanName; |
||||
|
||||
private BeanFactory beanFactory; |
||||
|
||||
|
||||
protected abstract PlaceholderResolver getPlaceholderResolver(Properties props); |
||||
|
||||
/** |
||||
* Set the prefix that a placeholder string starts with. |
||||
* The default is "${". |
||||
* @see #DEFAULT_PLACEHOLDER_PREFIX |
||||
*/ |
||||
public void setPlaceholderPrefix(String placeholderPrefix) { |
||||
this.placeholderPrefix = placeholderPrefix; |
||||
} |
||||
|
||||
/** |
||||
* Set the suffix that a placeholder string ends with. |
||||
* The default is "}". |
||||
* @see #DEFAULT_PLACEHOLDER_SUFFIX |
||||
*/ |
||||
public void setPlaceholderSuffix(String placeholderSuffix) { |
||||
this.placeholderSuffix = placeholderSuffix; |
||||
} |
||||
|
||||
/** |
||||
* Specify the separating character between the placeholder variable |
||||
* and the associated default value, or <code>null</code> if no such |
||||
* special character should be processed as a value separator. |
||||
* The default is ":". |
||||
*/ |
||||
public void setValueSeparator(String valueSeparator) { |
||||
this.valueSeparator = valueSeparator; |
||||
} |
||||
|
||||
/** |
||||
* Set a value that should be treated as <code>null</code> when |
||||
* resolved as a placeholder value: e.g. "" (empty String) or "null". |
||||
* <p>Note that this will only apply to full property values, |
||||
* not to parts of concatenated values. |
||||
* <p>By default, no such null value is defined. This means that |
||||
* there is no way to express <code>null</code> as a property |
||||
* value unless you explictly map a corresponding value here. |
||||
*/ |
||||
public void setNullValue(String nullValue) { |
||||
this.nullValue = nullValue; |
||||
} |
||||
|
||||
/** |
||||
* Set whether to ignore unresolvable placeholders. |
||||
* <p>Default is "false": An exception will be thrown if a placeholder fails |
||||
* to resolve. Switch this flag to "true" in order to preserve the placeholder |
||||
* String as-is in such a case, leaving it up to other placeholder configurers |
||||
* to resolve it. |
||||
*/ |
||||
public void setIgnoreUnresolvablePlaceholders(boolean ignoreUnresolvablePlaceholders) { |
||||
this.ignoreUnresolvablePlaceholders = ignoreUnresolvablePlaceholders; |
||||
} |
||||
|
||||
/** |
||||
* Only necessary to check that we're not parsing our own bean definition, |
||||
* to avoid failing on unresolvable placeholders in properties file locations. |
||||
* The latter case can happen with placeholders for system properties in |
||||
* resource locations. |
||||
* @see #setLocations |
||||
* @see org.springframework.core.io.ResourceEditor |
||||
*/ |
||||
public void setBeanName(String beanName) { |
||||
this.beanName = beanName; |
||||
} |
||||
|
||||
/** |
||||
* Only necessary to check that we're not parsing our own bean definition, |
||||
* to avoid failing on unresolvable placeholders in properties file locations. |
||||
* The latter case can happen with placeholders for system properties in |
||||
* resource locations. |
||||
* @see #setLocations |
||||
* @see org.springframework.core.io.ResourceEditor |
||||
*/ |
||||
public void setBeanFactory(BeanFactory beanFactory) { |
||||
this.beanFactory = beanFactory; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) |
||||
throws BeansException { |
||||
|
||||
StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver(props); |
||||
BeanDefinitionVisitor visitor = new BeanDefinitionVisitor(valueResolver); |
||||
|
||||
String[] beanNames = beanFactoryToProcess.getBeanDefinitionNames(); |
||||
for (String curName : beanNames) { |
||||
// Check that we're not parsing our own bean definition,
|
||||
// to avoid failing on unresolvable placeholders in properties file locations.
|
||||
if (!(curName.equals(this.beanName) && beanFactoryToProcess.equals(this.beanFactory))) { |
||||
BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(curName); |
||||
try { |
||||
visitor.visitBeanDefinition(bd); |
||||
} |
||||
catch (Exception ex) { |
||||
throw new BeanDefinitionStoreException(bd.getResourceDescription(), curName, ex.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
// New in Spring 2.5: resolve placeholders in alias target names and aliases as well.
|
||||
beanFactoryToProcess.resolveAliases(valueResolver); |
||||
|
||||
// New in Spring 3.0: resolve placeholders in embedded values such as annotation attributes.
|
||||
beanFactoryToProcess.addEmbeddedValueResolver(valueResolver); |
||||
} |
||||
|
||||
|
||||
private class PlaceholderResolvingStringValueResolver implements StringValueResolver { |
||||
|
||||
private final PropertyPlaceholderHelper helper; |
||||
|
||||
private final PlaceholderResolver resolver; |
||||
|
||||
public PlaceholderResolvingStringValueResolver(Properties props) { |
||||
this.helper = new PropertyPlaceholderHelper( |
||||
placeholderPrefix, placeholderSuffix, valueSeparator, ignoreUnresolvablePlaceholders); |
||||
this.resolver = getPlaceholderResolver(props); |
||||
} |
||||
|
||||
public String resolveStringValue(String strVal) throws BeansException { |
||||
String value = this.helper.replacePlaceholders(strVal, this.resolver); |
||||
return (value.equals(nullValue) ? null : value); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
@ -1,12 +1,15 @@
@@ -1,12 +1,15 @@
|
||||
http\://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd |
||||
http\://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd |
||||
http\://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd |
||||
http\://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd |
||||
http\://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd |
||||
http\://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd |
||||
http\://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd |
||||
http\://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd |
||||
http\://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd |
||||
http\://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd |
||||
http\://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd |
||||
http\://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd |
||||
http\://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd |
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,115 @@
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/tool" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
targetNamespace="http://www.springframework.org/schema/tool" |
||||
elementFormDefault="qualified"> |
||||
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the tool support annotations for Spring's configuration namespaces. |
||||
Used in other namespace XSD files; not intended for direct use in config files. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:element name="annotation"> |
||||
<xsd:complexType> |
||||
<xsd:sequence minOccurs="0"> |
||||
<xsd:element name="expected-type" type="typedParameterType" minOccurs="0" maxOccurs="1"/> |
||||
<xsd:element name="assignable-to" type="assignableToType" minOccurs="0" maxOccurs="1"/> |
||||
<xsd:element name="exports" type="exportsType" minOccurs="0" maxOccurs="unbounded"/> |
||||
<xsd:element name="registers-scope" type="registersScopeType" minOccurs="0" maxOccurs="unbounded"/> |
||||
<xsd:element name="expected-method" type="expectedMethodType" minOccurs="0" maxOccurs="unbounded"/> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="kind" default="direct"> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="ref"/> |
||||
<xsd:enumeration value="direct"/> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:complexType name="typedParameterType"> |
||||
<xsd:attribute name="type" type="xsd:string" use="required"/> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="assignableToType"> |
||||
<xsd:attribute name="type" type="xsd:string"/> |
||||
<xsd:attribute name="restriction" default="both"> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:NMTOKEN"> |
||||
<xsd:enumeration value="both"/> |
||||
<xsd:enumeration value="interface-only"/> |
||||
<xsd:enumeration value="class-only"/> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="expectedMethodType"> |
||||
<xsd:attribute name="type" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines an XPath query that can be executed against the node annotated with this |
||||
type to determine the class for which the this method is valid |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="type-ref" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines an XPath query that can be executed against the node annotated with this |
||||
type to determine a referenced bean (by id or alias) for which the given method is valid |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expression" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines an AspectJ method execution pointcut expressions that matches valid methods |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="exportsType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates that an annotated type exports an application visible component. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:attribute name="type" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The type of the exported component. May be null if the type is not known until runtime. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="identifier" type="xsd:string" default="@id"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines an XPath query that can be executed against the node annotated with this |
||||
type to determine the identifier of any exported component. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="registersScopeType"> |
||||
<xsd:attribute name="name" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the name of a custom bean scope that the annotated type registers, e.g. "conversation". |
||||
Such a scope will be available in addition to the standard "singleton" and "prototype" scopes |
||||
(plus "request", "session" and "globalSession" in a web application environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
</xsd:schema> |
||||
@ -0,0 +1,212 @@
@@ -0,0 +1,212 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/util" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/util" |
||||
elementFormDefault="qualified" |
||||
attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/> |
||||
|
||||
<xsd:element name="constant"> |
||||
<xsd:annotation> |
||||
<xsd:documentation> |
||||
Reference a public, static field on a type and expose its value as |
||||
a bean. For example <code><util:constant static-field="java.lang.Integer.MAX_VALUE"/></code>. |
||||
</xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="static-field" type="xsd:string" use="required"/> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="property-path"> |
||||
<xsd:annotation> |
||||
<xsd:documentation> |
||||
Reference a property on a bean (or as a nested value) and expose its values as |
||||
a bean. For example <util:property-path path="order.customer.name"/>. |
||||
</xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="path" type="xsd:string" use="required"/> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="list"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.beans.factory.config.ListFactoryBean"> |
||||
Builds a List instance of the specified type, populated with the specified content. |
||||
</xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="java.util.List"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:listOrSetType"> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="list-class" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class"/> |
||||
<tool:assignable-to type="java.util.List"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scope" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The scope of this collection bean: typically "singleton" (one shared instance, |
||||
which will be returned by all calls to getBean with the given id), or |
||||
"prototype" (independent instance resulting from each call to getBean). |
||||
Default is "singleton". Further scopes, such as "request" or "session", |
||||
might be supported by extended bean factories (e.g. in a web environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="set"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.beans.factory.config.SetFactoryBean"> |
||||
Builds a Set instance of the specified type, populated with the specified content. |
||||
</xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="java.util.Set"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:listOrSetType"> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="set-class" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class"/> |
||||
<tool:assignable-to type="java.util.Set"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scope" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The scope of this collection bean: typically "singleton" (one shared instance, |
||||
which will be returned by all calls to getBean with the given id), or |
||||
"prototype" (independent instance resulting from each call to getBean). |
||||
Default is "singleton". Further scopes, such as "request" or "session", |
||||
might be supported by extended bean factories (e.g. in a web environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="map"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.beans.factory.config.MapFactoryBean"> |
||||
Builds a Map instance of the specified type, populated with the specified content. |
||||
</xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="java.util.Map"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:mapType"> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="map-class" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class"/> |
||||
<tool:assignable-to type="java.util.Map"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scope" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The scope of this collection bean: typically "singleton" (one shared instance, |
||||
which will be returned by all calls to getBean with the given id), or |
||||
"prototype" (independent instance resulting from each call to getBean). |
||||
Default is "singleton". Further scopes, such as "request" or "session", |
||||
might be supported by extended bean factories (e.g. in a web environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="properties"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.beans.factory.config.PropertiesFactoryBean"> |
||||
Loads a Properties instance from the resource location specified by the '<code>location</code>' attribute. |
||||
</xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="java.util.Properties"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:propsType"> |
||||
<xsd:attribute name="id" type="xsd:string"/> |
||||
<xsd:attribute name="location" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="org.springframework.core.io.Resource"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="local-override" type="xsd:boolean"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies whether local properties override properties from files. |
||||
Default is "false": properties from files override local defaults. |
||||
If set to "true", local properties will override defaults from files. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scope" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The scope of this collection bean: typically "singleton" (one shared instance, |
||||
which will be returned by all calls to getBean with the given id), or |
||||
"prototype" (independent instance resulting from each call to getBean). |
||||
Default is "singleton". Further scopes, such as "request" or "session", |
||||
might be supported by extended bean factories (e.g. in a web environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
</xsd:schema> |
||||
@ -1,44 +1,281 @@
@@ -1,44 +1,281 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.beans.factory.config; |
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo; |
||||
import static org.hamcrest.CoreMatchers.is; |
||||
import static org.hamcrest.CoreMatchers.nullValue; |
||||
import static org.junit.Assert.assertThat; |
||||
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition; |
||||
import static org.springframework.beans.factory.support.BeanDefinitionReaderUtils.registerWithGeneratedName; |
||||
|
||||
import java.lang.reflect.Field; |
||||
import java.util.Collections; |
||||
import java.util.Map; |
||||
import java.util.Properties; |
||||
|
||||
import org.junit.After; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition; |
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
||||
import org.springframework.core.io.ByteArrayResource; |
||||
|
||||
import test.beans.TestBean; |
||||
|
||||
|
||||
/** |
||||
* Tests cornering SPR-7547. |
||||
* Unit tests for {@link EnvironmentAwarePropertyPlaceholderConfigurer}. |
||||
* |
||||
* @see PropertyResourceConfigurerTests |
||||
* @author Chris Beams |
||||
*/ |
||||
public class PropertyPlaceholderConfigurerTests { |
||||
private static final String P1 = "p1"; |
||||
private static final String P1_LOCAL_PROPS_VAL = "p1LocalPropsVal"; |
||||
private static final String P1_SYSTEM_PROPS_VAL = "p1SystemPropsVal"; |
||||
private static final String P1_SYSTEM_ENV_VAL = "p1SystemEnvVal"; |
||||
|
||||
private DefaultListableBeanFactory bf; |
||||
private AbstractPropertyPlaceholderConfigurer ppc; |
||||
private Properties ppcProperties; |
||||
|
||||
private AbstractBeanDefinition p1BeanDef; |
||||
|
||||
@Before |
||||
public void setUp() { |
||||
p1BeanDef = rootBeanDefinition(TestBean.class) |
||||
.addPropertyValue("name", "${"+P1+"}") |
||||
.getBeanDefinition(); |
||||
|
||||
bf = new DefaultListableBeanFactory(); |
||||
|
||||
ppcProperties = new Properties(); |
||||
ppcProperties.setProperty(P1, P1_LOCAL_PROPS_VAL); |
||||
System.setProperty(P1, P1_SYSTEM_PROPS_VAL); |
||||
getModifiableSystemEnvironment().put(P1, P1_SYSTEM_ENV_VAL); |
||||
ppc = new PropertyPlaceholderConfigurer(); |
||||
ppc.setProperties(ppcProperties); |
||||
|
||||
} |
||||
|
||||
@After |
||||
public void tearDown() { |
||||
System.clearProperty(P1); |
||||
getModifiableSystemEnvironment().remove(P1); |
||||
} |
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Tests to ensure backward-compatibility for Environment refactoring
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Test |
||||
public void resolveFromSystemProperties() { |
||||
getModifiableSystemEnvironment().put("otherKey", "systemValue"); |
||||
p1BeanDef = rootBeanDefinition(TestBean.class) |
||||
.addPropertyValue("name", "${"+P1+"}") |
||||
.addPropertyValue("sex", "${otherKey}") |
||||
.getBeanDefinition(); |
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); |
||||
assertThat(bean.getSex(), equalTo("systemValue")); |
||||
getModifiableSystemEnvironment().remove("otherKey"); |
||||
} |
||||
|
||||
@Test |
||||
public void resolveFromLocalProperties() { |
||||
tearDown(); // eliminate entries from system props/environment
|
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); |
||||
} |
||||
|
||||
@Test |
||||
public void setSystemPropertiesMode_defaultIsFallback() { |
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); |
||||
} |
||||
|
||||
/* |
||||
@Test |
||||
public void setSystemSystemPropertiesMode_toOverride_andResolveFromSystemProperties() { |
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
ppc.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_SYSTEM_PROPS_VAL)); |
||||
} |
||||
|
||||
@Test |
||||
public void setSystemSystemPropertiesMode_toOverride_andResolveFromSystemEnvironment() { |
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
System.clearProperty(P1); // will now fall all the way back to system environment
|
||||
ppc.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_SYSTEM_ENV_VAL)); |
||||
} |
||||
|
||||
@Test |
||||
public void setSystemSystemPropertiesMode_toOverride_andSetSearchSystemEnvironment_toFalse() { |
||||
registerWithGeneratedName(p1BeanDef, bf); |
||||
System.clearProperty(P1); // will now fall all the way back to system environment
|
||||
ppc.setSearchSystemEnvironment(false); |
||||
ppc.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); |
||||
ppc.postProcessBeanFactory(bf); |
||||
TestBean bean = bf.getBean(TestBean.class); |
||||
assertThat(bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); // has to resort to local props
|
||||
} |
||||
*/ |
||||
|
||||
/** |
||||
* Prior to the fix for SPR-7547, the following would throw |
||||
* IllegalStateException because the PropertiesLoaderSupport base class
|
||||
* assumed ByteArrayResource implements Resource.getFilename(). It does |
||||
* not, and AbstractResource.getFilename() is called instead, raising the |
||||
* exception. The following now works, as getFilename() is called in a |
||||
* try/catch to check whether the resource is actually file-based or not. |
||||
* |
||||
* See SPR-7552, which suggests paths to address the root issue rather than |
||||
* just patching the problem. |
||||
* Creates a scenario in which two PPCs are configured, each with different |
||||
* settings regarding resolving properties from the environment. |
||||
*/ |
||||
@Test |
||||
public void repro() { |
||||
public void twoPlacholderConfigurers_withConflictingSettings() { |
||||
String P2 = "p2"; |
||||
String P2_LOCAL_PROPS_VAL = "p2LocalPropsVal"; |
||||
String P2_SYSTEM_PROPS_VAL = "p2SystemPropsVal"; |
||||
String P2_SYSTEM_ENV_VAL = "p2SystemEnvVal"; |
||||
|
||||
AbstractBeanDefinition p2BeanDef = rootBeanDefinition(TestBean.class) |
||||
.addPropertyValue("name", "${"+P1+"}") |
||||
.addPropertyValue("country", "${"+P2+"}") |
||||
.getBeanDefinition(); |
||||
|
||||
bf.registerBeanDefinition("p1Bean", p1BeanDef); |
||||
bf.registerBeanDefinition("p2Bean", p2BeanDef); |
||||
|
||||
ppc.setIgnoreUnresolvablePlaceholders(true); |
||||
ppc.postProcessBeanFactory(bf); |
||||
|
||||
System.setProperty(P2, P2_SYSTEM_PROPS_VAL); |
||||
getModifiableSystemEnvironment().put(P2, P2_SYSTEM_ENV_VAL); |
||||
Properties ppc2Properties = new Properties(); |
||||
ppc2Properties.put(P2, P2_LOCAL_PROPS_VAL); |
||||
|
||||
PropertyPlaceholderConfigurer ppc2 = new PropertyPlaceholderConfigurer(); |
||||
ppc2.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); |
||||
ppc2.setProperties(ppc2Properties); |
||||
|
||||
ppc2Properties = new Properties(); |
||||
ppc2Properties.setProperty(P2, P2_LOCAL_PROPS_VAL); |
||||
ppc2.postProcessBeanFactory(bf); |
||||
|
||||
TestBean p1Bean = bf.getBean("p1Bean", TestBean.class); |
||||
assertThat(p1Bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); |
||||
|
||||
TestBean p2Bean = bf.getBean("p2Bean", TestBean.class); |
||||
assertThat(p2Bean.getName(), equalTo(P1_LOCAL_PROPS_VAL)); |
||||
assertThat(p2Bean.getCountry(), equalTo(P2_SYSTEM_PROPS_VAL)); |
||||
|
||||
System.clearProperty(P2); |
||||
getModifiableSystemEnvironment().remove(P2); |
||||
} |
||||
|
||||
@Test |
||||
public void customPlaceholderPrefixAndSuffix() { |
||||
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); |
||||
ppc.setPlaceholderPrefix("@<"); |
||||
ppc.setPlaceholderSuffix(">"); |
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
bf.registerBeanDefinition("testBean", |
||||
rootBeanDefinition(TestBean.class) |
||||
.addPropertyValue("name", "${my.name}").getBeanDefinition()); |
||||
.addPropertyValue("name", "@<key1>") |
||||
.addPropertyValue("sex", "${key2}") |
||||
.getBeanDefinition()); |
||||
|
||||
System.setProperty("key1", "systemKey1Value"); |
||||
System.setProperty("key2", "systemKey2Value"); |
||||
ppc.postProcessBeanFactory(bf); |
||||
System.clearProperty("key1"); |
||||
System.clearProperty("key2"); |
||||
|
||||
assertThat(bf.getBean(TestBean.class).getName(), is("systemKey1Value")); |
||||
assertThat(bf.getBean(TestBean.class).getSex(), is("${key2}")); |
||||
} |
||||
|
||||
@Test |
||||
public void nullValueIsPreserved() { |
||||
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); |
||||
ppc.setLocation(new ByteArrayResource("my.name=Inigo Montoya".getBytes())); |
||||
ppc.setNullValue("customNull"); |
||||
getModifiableSystemEnvironment().put("my.name", "customNull"); |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
bf.registerBeanDefinition("testBean", rootBeanDefinition(TestBean.class) |
||||
.addPropertyValue("name", "${my.name}") |
||||
.getBeanDefinition()); |
||||
ppc.postProcessBeanFactory(bf); |
||||
assertThat(bf.getBean(TestBean.class).getName(), nullValue()); |
||||
getModifiableSystemEnvironment().remove("my.name"); |
||||
} |
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Tests for functionality not possible prior to Environment refactoring
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/** |
||||
* Tests that properties against a BeanFactory's Environment are used by |
||||
* PropertyPlaceholderConfigurer during placeholder resolution. |
||||
@Test @SuppressWarnings({ "unchecked", "rawtypes", "serial" }) |
||||
public void replacePlaceholdersFromBeanFactoryEnvironmentPropertySources() { |
||||
System.setProperty("key1", "systemValue"); |
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
bf.getEnvironment().addPropertySource("psCustom", new HashMap() {{ put("key1", "customValue"); }}); |
||||
bf.registerBeanDefinition("testBean", |
||||
rootBeanDefinition(TestBean.class).addPropertyValue("name", "${key1}").getBeanDefinition()); |
||||
|
||||
new PropertyPlaceholderConfigurer().postProcessBeanFactory(bf); |
||||
assertThat(bf.getBean(TestBean.class).getName(), is("customValue")); |
||||
|
||||
System.clearProperty("key1"); |
||||
} |
||||
*/ |
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Utilities
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
TestBean testBean = bf.getBean(TestBean.class); |
||||
assertThat(testBean.getName(), equalTo("Inigo Montoya")); |
||||
// TODO SPR-7508: duplicated from EnvironmentPropertyResolutionSearchTests
|
||||
@SuppressWarnings("unchecked") |
||||
private static Map<String, String> getModifiableSystemEnvironment() { |
||||
Class<?>[] classes = Collections.class.getDeclaredClasses(); |
||||
Map<String, String> env = System.getenv(); |
||||
for (Class<?> cl : classes) { |
||||
if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { |
||||
try { |
||||
Field field = cl.getDeclaredField("m"); |
||||
field.setAccessible(true); |
||||
Object obj = field.get(env); |
||||
return (Map<String, String>) obj; |
||||
} catch (Exception ex) { |
||||
throw new RuntimeException(ex); |
||||
} |
||||
} |
||||
} |
||||
throw new IllegalStateException(); |
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<bean id="testBean" class="test.beans.TestBean"> |
||||
<property name="name" value="topLevel"/> |
||||
</bean> |
||||
|
||||
<beans> |
||||
<bean id="testBean" class="test.beans.TestBean"> |
||||
<property name="name" value="nested"/> |
||||
</bean> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<bean id="testBean" class="test.beans.TestBean"> |
||||
<property name="name" value="original"/> |
||||
</bean> |
||||
|
||||
<!-- STS should raise an error for this duplicate id --> |
||||
<bean id="testBean" class="test.beans.TestBean"> |
||||
<property name="name" value="duplicate"/> |
||||
</bean> |
||||
</beans> |
||||
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.beans.factory.xml; |
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo; |
||||
import static org.junit.Assert.assertThat; |
||||
import static org.junit.Assert.fail; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
||||
import org.springframework.core.io.ClassPathResource; |
||||
|
||||
import test.beans.TestBean; |
||||
|
||||
|
||||
/** |
||||
* With Spring 3.1, bean id attributes (and all other id attributes across the |
||||
* core schemas) are no longer typed as xsd:id, but as xsd:string. This allows |
||||
* for using the same bean id within nested <beans> elements. |
||||
* |
||||
* Duplicate ids *within the same level of nesting* will still be treated as an |
||||
* error through the ProblemReporter, as this could never be an intended/valid |
||||
* situation. |
||||
* |
||||
* @author Chris Beams |
||||
* @since 3.1 |
||||
* @see org.springframework.beans.factory.xml.XmlBeanFactoryTests#testWithDuplicateName |
||||
* @see org.springframework.beans.factory.xml.XmlBeanFactoryTests#testWithDuplicateNameInAlias |
||||
*/ |
||||
public class DuplicateBeanIdTests { |
||||
|
||||
@Test |
||||
public void duplicateBeanIdsWithinSameNestingLevelRaisesError() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); |
||||
try { |
||||
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-sameLevel-context.xml", this.getClass())); |
||||
fail("expected parsing exception due to duplicate ids in same nesting level"); |
||||
} catch (Exception ex) { |
||||
// expected
|
||||
} |
||||
} |
||||
|
||||
@Test |
||||
public void duplicateBeanIdsAcrossNestingLevels() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); |
||||
reader.loadBeanDefinitions(new ClassPathResource("DuplicateBeanIdTests-multiLevel-context.xml", this.getClass())); |
||||
TestBean testBean = bf.getBean(TestBean.class); // there should be only one
|
||||
assertThat(testBean.getName(), equalTo("nested")); |
||||
} |
||||
} |
||||
@ -0,0 +1,113 @@
@@ -0,0 +1,113 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.beans.factory.xml; |
||||
|
||||
import static org.hamcrest.CoreMatchers.not; |
||||
import static org.junit.Assert.assertThat; |
||||
|
||||
import org.hamcrest.Description; |
||||
import org.hamcrest.Matcher; |
||||
import org.junit.Test; |
||||
import org.junit.internal.matchers.TypeSafeMatcher; |
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry; |
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
||||
import org.springframework.core.env.DefaultEnvironment; |
||||
import org.springframework.core.io.ClassPathResource; |
||||
|
||||
/** |
||||
* TODO SPR-7508: document |
||||
* |
||||
* @author Chris Beams |
||||
*/ |
||||
public class EnvironmentBeansTests { |
||||
|
||||
private static final String PROD_ELIGIBLE_XML = "environmentBeans-prodProfile.xml"; |
||||
private static final String DEV_ELIGIBLE_XML = "environmentBeans-devProfile.xml"; |
||||
private static final String ALL_ELIGIBLE_XML = "environmentBeans-noProfile.xml"; |
||||
private static final String MULTI_ELIGIBLE_XML = "environmentBeans-multiProfile.xml"; |
||||
private static final String UNKOWN_ELIGIBLE_XML = "environmentBeans-unknownProfile.xml"; |
||||
|
||||
private static final String PROD_ACTIVE = "prod"; |
||||
private static final String DEV_ACTIVE = "dev"; |
||||
private static final String NULL_ACTIVE = null; |
||||
private static final String UNKNOWN_ACTIVE = "unknown"; |
||||
private static final String[] NONE_ACTIVE = new String[0]; |
||||
private static final String[] MULTI_ACTIVE = new String[] { PROD_ACTIVE, DEV_ACTIVE }; |
||||
|
||||
private static final String TARGET_BEAN = "foo"; |
||||
|
||||
@Test |
||||
public void test() { |
||||
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, NONE_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, NULL_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, DEV_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, PROD_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(PROD_ELIGIBLE_XML, MULTI_ACTIVE), containsTargetBean()); |
||||
|
||||
assertThat(beanFactoryFor(DEV_ELIGIBLE_XML, NONE_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(DEV_ELIGIBLE_XML, NULL_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(DEV_ELIGIBLE_XML, PROD_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(DEV_ELIGIBLE_XML, DEV_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(DEV_ELIGIBLE_XML, MULTI_ACTIVE), containsTargetBean()); |
||||
|
||||
assertThat(beanFactoryFor(ALL_ELIGIBLE_XML, NONE_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(ALL_ELIGIBLE_XML, NULL_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(ALL_ELIGIBLE_XML, DEV_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(ALL_ELIGIBLE_XML, PROD_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(ALL_ELIGIBLE_XML, MULTI_ACTIVE), containsTargetBean()); |
||||
|
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, NONE_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, NULL_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, UNKNOWN_ACTIVE), not(containsTargetBean())); |
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, DEV_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, PROD_ACTIVE), containsTargetBean()); |
||||
assertThat(beanFactoryFor(MULTI_ELIGIBLE_XML, MULTI_ACTIVE), containsTargetBean()); |
||||
|
||||
assertThat(beanFactoryFor(UNKOWN_ELIGIBLE_XML, MULTI_ACTIVE), not(containsTargetBean())); |
||||
} |
||||
|
||||
private BeanDefinitionRegistry beanFactoryFor(String xmlName, String... activeProfileNames) { |
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); |
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); |
||||
DefaultEnvironment env = new DefaultEnvironment(); |
||||
env.setActiveProfiles(activeProfileNames); |
||||
reader.setEnvironment(env); |
||||
reader.loadBeanDefinitions(new ClassPathResource(xmlName, getClass())); |
||||
return beanFactory; |
||||
} |
||||
|
||||
|
||||
private static Matcher<BeanDefinitionRegistry> containsBeanDefinition(final String beanName) { |
||||
return new TypeSafeMatcher<BeanDefinitionRegistry>() { |
||||
|
||||
public void describeTo(Description desc) { |
||||
desc.appendText("a BeanDefinitionRegistry containing bean named ") |
||||
.appendValue(beanName); |
||||
} |
||||
|
||||
@Override |
||||
public boolean matchesSafely(BeanDefinitionRegistry beanFactory) { |
||||
return beanFactory.containsBeanDefinition(beanName); |
||||
} |
||||
|
||||
}; |
||||
} |
||||
|
||||
private static Matcher<BeanDefinitionRegistry> containsTargetBean() { |
||||
return containsBeanDefinition(TARGET_BEAN); |
||||
} |
||||
} |
||||
@ -0,0 +1,148 @@
@@ -0,0 +1,148 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.beans.factory.xml; |
||||
|
||||
import static org.hamcrest.CoreMatchers.is; |
||||
import static org.hamcrest.CoreMatchers.not; |
||||
import static org.hamcrest.Matchers.hasItems; |
||||
import static org.junit.Assert.assertThat; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.beans.factory.config.BeanDefinition; |
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
||||
import org.springframework.core.io.ClassPathResource; |
||||
|
||||
import test.beans.TestBean; |
||||
|
||||
/** |
||||
* Tests for propagating enclosing beans element defaults to nested beans elements. |
||||
* |
||||
* @author Chris Beams |
||||
*/ |
||||
public class NestedBeansElementAttributeRecursionTests { |
||||
|
||||
@Test |
||||
public void defaultLazyInit() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions( |
||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-lazy-context.xml", this.getClass())); |
||||
|
||||
BeanDefinition foo = bf.getBeanDefinition("foo"); |
||||
BeanDefinition bar = bf.getBeanDefinition("bar"); |
||||
BeanDefinition baz = bf.getBeanDefinition("baz"); |
||||
BeanDefinition biz = bf.getBeanDefinition("biz"); |
||||
BeanDefinition buz = bf.getBeanDefinition("buz"); |
||||
|
||||
assertThat(foo.isLazyInit(), is(false)); |
||||
assertThat(bar.isLazyInit(), is(true)); |
||||
assertThat(baz.isLazyInit(), is(false)); |
||||
assertThat(biz.isLazyInit(), is(true)); |
||||
assertThat(buz.isLazyInit(), is(true)); |
||||
} |
||||
|
||||
@Test |
||||
@SuppressWarnings("unchecked") |
||||
public void defaultMerge() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions( |
||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-merge-context.xml", this.getClass())); |
||||
|
||||
TestBean topLevel = bf.getBean("topLevelConcreteTestBean", TestBean.class); |
||||
// has the concrete child bean values
|
||||
assertThat(topLevel.getSomeList(), hasItems("charlie", "delta")); |
||||
// but does not merge the parent values
|
||||
assertThat(topLevel.getSomeList(), not(hasItems("alpha", "bravo"))); |
||||
|
||||
TestBean firstLevel = bf.getBean("firstLevelNestedTestBean", TestBean.class); |
||||
// merges all values
|
||||
assertThat(firstLevel.getSomeList(), |
||||
hasItems("charlie", "delta", "echo", "foxtrot")); |
||||
|
||||
TestBean secondLevel = bf.getBean("secondLevelNestedTestBean", TestBean.class); |
||||
// merges all values
|
||||
assertThat(secondLevel.getSomeList(), |
||||
hasItems("charlie", "delta", "echo", "foxtrot", "golf", "hotel")); |
||||
} |
||||
|
||||
@Test |
||||
public void defaultAutowireCandidates() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions( |
||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-autowire-candidates-context.xml", this.getClass())); |
||||
|
||||
assertThat(bf.getBeanDefinition("fooService").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("fooRepository").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("other").isAutowireCandidate(), is(false)); |
||||
|
||||
assertThat(bf.getBeanDefinition("barService").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("fooController").isAutowireCandidate(), is(false)); |
||||
|
||||
assertThat(bf.getBeanDefinition("bizRepository").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("bizService").isAutowireCandidate(), is(false)); |
||||
|
||||
assertThat(bf.getBeanDefinition("bazService").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("random").isAutowireCandidate(), is(false)); |
||||
assertThat(bf.getBeanDefinition("fooComponent").isAutowireCandidate(), is(false)); |
||||
assertThat(bf.getBeanDefinition("fRepository").isAutowireCandidate(), is(false)); |
||||
|
||||
assertThat(bf.getBeanDefinition("aComponent").isAutowireCandidate(), is(true)); |
||||
assertThat(bf.getBeanDefinition("someService").isAutowireCandidate(), is(false)); |
||||
} |
||||
|
||||
@Test |
||||
public void initMethod() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions( |
||||
new ClassPathResource("NestedBeansElementAttributeRecursionTests-init-destroy-context.xml", this.getClass())); |
||||
|
||||
InitDestroyBean beanA = bf.getBean("beanA", InitDestroyBean.class); |
||||
InitDestroyBean beanB = bf.getBean("beanB", InitDestroyBean.class); |
||||
InitDestroyBean beanC = bf.getBean("beanC", InitDestroyBean.class); |
||||
InitDestroyBean beanD = bf.getBean("beanD", InitDestroyBean.class); |
||||
|
||||
assertThat(beanA.initMethod1Called, is(true)); |
||||
assertThat(beanB.initMethod2Called, is(true)); |
||||
assertThat(beanC.initMethod3Called, is(true)); |
||||
assertThat(beanD.initMethod2Called, is(true)); |
||||
|
||||
bf.destroySingletons(); |
||||
|
||||
assertThat(beanA.destroyMethod1Called, is(true)); |
||||
assertThat(beanB.destroyMethod2Called, is(true)); |
||||
assertThat(beanC.destroyMethod3Called, is(true)); |
||||
assertThat(beanD.destroyMethod2Called, is(true)); |
||||
} |
||||
|
||||
} |
||||
|
||||
class InitDestroyBean { |
||||
boolean initMethod1Called; |
||||
boolean initMethod2Called; |
||||
boolean initMethod3Called; |
||||
|
||||
boolean destroyMethod1Called; |
||||
boolean destroyMethod2Called; |
||||
boolean destroyMethod3Called; |
||||
|
||||
void initMethod1() { this.initMethod1Called = true; } |
||||
void initMethod2() { this.initMethod2Called = true; } |
||||
void initMethod3() { this.initMethod3Called = true; } |
||||
|
||||
void destroyMethod1() { this.destroyMethod1Called = true; } |
||||
void destroyMethod2() { this.destroyMethod2Called = true; } |
||||
void destroyMethod3() { this.destroyMethod3Called = true; } |
||||
} |
||||
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
package org.springframework.beans.factory.xml; |
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf; |
||||
import static org.junit.Assert.assertThat; |
||||
|
||||
import org.junit.Test; |
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory; |
||||
import org.springframework.core.env.ConfigurableEnvironment; |
||||
import org.springframework.core.env.DefaultEnvironment; |
||||
import org.springframework.core.io.ClassPathResource; |
||||
import org.springframework.core.io.Resource; |
||||
|
||||
/** |
||||
* Tests for new nested beans element support in Spring XML |
||||
* |
||||
* @author Chris Beams |
||||
*/ |
||||
public class NestedBeansElementTests { |
||||
private final Resource XML = |
||||
new ClassPathResource("NestedBeansElementTests-context.xml", this.getClass()); |
||||
|
||||
@Test |
||||
public void getBean_withoutActiveProfile() { |
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(XML); |
||||
|
||||
Object foo = bf.getBean("foo"); |
||||
assertThat(foo, instanceOf(String.class)); |
||||
} |
||||
|
||||
@Test |
||||
public void getBean_withActiveProfile() { |
||||
ConfigurableEnvironment env = new DefaultEnvironment(); |
||||
env.setActiveProfiles("dev"); |
||||
|
||||
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(bf); |
||||
reader.setEnvironment(env); |
||||
reader.loadBeanDefinitions(XML); |
||||
|
||||
bf.getBean("devOnlyBean"); // should not throw NSBDE
|
||||
|
||||
Object foo = bf.getBean("foo"); |
||||
assertThat(foo, instanceOf(Integer.class)); |
||||
|
||||
bf.getBean("devOnlyBean"); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
default-autowire-candidates="foo*"> |
||||
|
||||
<bean id="fooRepository" class="java.lang.Object"/> |
||||
<bean id="fooService" class="java.lang.Object"/> |
||||
<bean id="other" class="java.lang.Object"/> |
||||
|
||||
<beans default-autowire-candidates="*Service"> |
||||
<bean id="barService" class="java.lang.Object"/> |
||||
<bean id="fooController" class="java.lang.Object"/> |
||||
|
||||
<beans default-autowire-candidates="*Repository"> |
||||
<bean id="bizRepository" class="java.lang.Object"/> |
||||
<bean id="bizService" class="java.lang.Object"/> |
||||
</beans> |
||||
|
||||
<beans> <!-- should inherit enclosing beans' defaults --> |
||||
<bean id="bazService" class="java.lang.Object"/> |
||||
<bean id="random" class="java.lang.Object"/> |
||||
<bean id="fooComponent" class="java.lang.Object"/> |
||||
<bean id="fRepository" class="java.lang.Object"/> |
||||
</beans> |
||||
|
||||
<beans default-autowire-candidates="*Component"> |
||||
<bean id="aComponent" class="java.lang.Object"/> |
||||
<bean id="someService" class="java.lang.Object"/> |
||||
</beans> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<bean id="foo" class="java.lang.Object"/> |
||||
|
||||
<beans default-autowire="constructor"> |
||||
<bean id="bar" class="java.lang.Object"/> |
||||
|
||||
<beans> |
||||
<bean id="baz" class="java.lang.Object"/> |
||||
</beans> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
default-init-method="initMethod1" |
||||
default-destroy-method="destroyMethod1"> |
||||
|
||||
<bean id="beanA" class="org.springframework.beans.factory.xml.InitDestroyBean"/> |
||||
|
||||
<beans default-init-method="initMethod2" default-destroy-method="destroyMethod2"> |
||||
<bean id="beanB" class="org.springframework.beans.factory.xml.InitDestroyBean"/> |
||||
|
||||
<beans default-init-method="initMethod3" default-destroy-method="destroyMethod3"> |
||||
<bean id="beanC" class="org.springframework.beans.factory.xml.InitDestroyBean"/> |
||||
</beans> |
||||
|
||||
<beans> <!-- should fall back to outer defaults (initMethod2 and destroyMethod2) --> |
||||
<bean id="beanD" class="org.springframework.beans.factory.xml.InitDestroyBean"/> |
||||
</beans> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<!-- lazy == false (based on default XSD values) --> |
||||
<bean id="foo" class="java.lang.Object"/> |
||||
|
||||
<beans default-lazy-init="true"> |
||||
<!-- lazy == true (explicit default specified) --> |
||||
<bean id="bar" class="java.lang.Object"/> |
||||
</beans> |
||||
|
||||
<beans default-lazy-init="false"> |
||||
<!-- lazy == false (explicit default specified) --> |
||||
<bean id="baz" class="java.lang.Object"/> |
||||
</beans> |
||||
|
||||
<beans default-lazy-init="true"> |
||||
<!-- lazy == true (explicit default specified) --> |
||||
<bean id="biz" class="java.lang.Object"/> |
||||
|
||||
<beans> |
||||
<!-- lazy == true (inherit enclosing <beans> defaults --> |
||||
<bean id="buz" class="java.lang.Object"/> |
||||
</beans> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
default-merge="false"> |
||||
|
||||
<bean id="abstractTestBean" class="test.beans.TestBean" abstract="true"> |
||||
<property name="someList"> |
||||
<list> |
||||
<value>alpha</value> |
||||
<value>bravo</value> |
||||
</list> |
||||
</property> |
||||
</bean> |
||||
|
||||
<bean id="topLevelConcreteTestBean" parent="abstractTestBean"> |
||||
<property name="someList"> |
||||
<list> |
||||
<value>charlie</value> |
||||
<value>delta</value> |
||||
</list> |
||||
</property> |
||||
</bean> |
||||
|
||||
<beans default-merge="true"> |
||||
<bean id="firstLevelNestedTestBean" parent="topLevelConcreteTestBean"> |
||||
<property name="someList"> |
||||
<list> |
||||
<value>echo</value> |
||||
<value>foxtrot</value> |
||||
</list> |
||||
</property> |
||||
</bean> |
||||
|
||||
<beans> |
||||
<bean id="secondLevelNestedTestBean" parent="firstLevelNestedTestBean"> |
||||
<property name="someList"> |
||||
<list> |
||||
<value>golf</value> |
||||
<value>hotel</value> |
||||
</list> |
||||
</property> |
||||
</bean> |
||||
</beans> |
||||
</beans> |
||||
</beans> |
||||
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
|
||||
<beans profile="dev"> |
||||
<!-- should override the 'foo' bean above when the 'dev' profile is active --> |
||||
<bean name="foo" class="java.lang.Integer"> |
||||
<constructor-arg value="42"/> |
||||
</bean> |
||||
|
||||
<!-- should only be available when the 'dev' profile is active --> |
||||
<bean name="devOnlyBean" class="java.lang.Object"/> |
||||
</beans> |
||||
|
||||
</beans> |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
profile="dev"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
</beans> |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
profile="dev,prod"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
</beans> |
||||
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
</beans> |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
profile="prod"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
</beans> |
||||
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans |
||||
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" |
||||
profile="unknown"> |
||||
|
||||
<bean id="foo" class="java.lang.String"/> |
||||
</beans> |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.context; |
||||
|
||||
import org.springframework.core.env.Environment; |
||||
|
||||
/** |
||||
* TODO SPR-7515: document |
||||
* |
||||
* @author Chris Beams |
||||
*/ |
||||
public interface EnvironmentAware { |
||||
|
||||
void setEnvironment(Environment environment); |
||||
|
||||
} |
||||
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.context.annotation; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator; |
||||
|
||||
|
||||
/** |
||||
* Configures component scanning directives for use with {@link Configuration} |
||||
* classes. Provides support parallel with Spring XML's |
||||
* <context:component-scan> element. |
||||
* |
||||
* TODO SPR-7508: complete documentation. |
||||
* |
||||
* @author Chris Beams |
||||
* @since 3.1 |
||||
* @see FilterType |
||||
* @see Configuration |
||||
*/ |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Target(ElementType.TYPE) |
||||
public @interface ComponentScan { |
||||
|
||||
/** base packages to scan */ |
||||
String[] value() default {}; |
||||
|
||||
Class<?>[] packageOf() default Void.class; |
||||
|
||||
Class<? extends BeanNameGenerator> nameGenerator() default AnnotationBeanNameGenerator.class; |
||||
|
||||
Class<? extends ScopeMetadataResolver> scopeResolver() default AnnotationScopeMetadataResolver.class; |
||||
|
||||
String resourcePattern() default "**/*.class"; |
||||
|
||||
ScopedProxyMode scopedProxy() default ScopedProxyMode.DEFAULT; |
||||
|
||||
boolean useDefaultFilters() default true; |
||||
|
||||
IncludeFilter[] includeFilters() default {}; |
||||
|
||||
ExcludeFilter[] excludeFilters() default {}; |
||||
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE) |
||||
@interface IncludeFilter { |
||||
FilterType type() default FilterType.ANNOTATION; |
||||
Class<?> value(); |
||||
} |
||||
|
||||
@Retention(RetentionPolicy.SOURCE) |
||||
@interface ExcludeFilter { |
||||
FilterType type() default FilterType.ANNOTATION; |
||||
Class<?> value(); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.context.annotation; |
||||
|
||||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; |
||||
import static java.lang.annotation.ElementType.TYPE; |
||||
|
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* @author Chris Beams |
||||
* @since 3.1 |
||||
*/ |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Target({ |
||||
ANNOTATION_TYPE, // @Profile may be used as a meta-annotation
|
||||
TYPE // In conjunction with @Component and its derivatives
|
||||
}) |
||||
public @interface Profile { |
||||
|
||||
/** |
||||
* @see #value() |
||||
*/ |
||||
static final String CANDIDATE_PROFILES_ATTRIB_NAME = "value"; |
||||
|
||||
/** |
||||
* TODO SPR-7508: document |
||||
*/ |
||||
String[] value(); |
||||
} |
||||
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.context.expression; |
||||
|
||||
import org.springframework.core.env.Environment; |
||||
import org.springframework.expression.AccessException; |
||||
import org.springframework.expression.EvaluationContext; |
||||
import org.springframework.expression.PropertyAccessor; |
||||
import org.springframework.expression.TypedValue; |
||||
|
||||
/** |
||||
* Read-only EL property accessor that knows how to retrieve keys |
||||
* of a Spring {@link Environment} instance. |
||||
* |
||||
* @author Chris Beams |
||||
* @since 3.1 |
||||
*/ |
||||
public class EnvironmentAccessor implements PropertyAccessor { |
||||
|
||||
public Class<?>[] getSpecificTargetClasses() { |
||||
return new Class[] { Environment.class }; |
||||
} |
||||
|
||||
/** |
||||
* Can read any {@link Environment}, thus always returns true. |
||||
* @return true |
||||
*/ |
||||
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { |
||||
return true; |
||||
} |
||||
|
||||
/** |
||||
* Access provided {@literal target} object by calling its {@link Environment#getProperty(String)} |
||||
* method with the provided {@literal name}. |
||||
*/ |
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { |
||||
return new TypedValue(((Environment)target).getProperty(name)); |
||||
} |
||||
|
||||
/** |
||||
* Read only. |
||||
* @return false |
||||
*/ |
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException { |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* Read only. No-op. |
||||
*/ |
||||
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException { |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,115 @@
@@ -0,0 +1,115 @@
|
||||
/* |
||||
* Copyright 2002-2010 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.context.support; |
||||
|
||||
import java.util.LinkedList; |
||||
import java.util.Properties; |
||||
|
||||
import org.springframework.beans.BeansException; |
||||
import org.springframework.beans.factory.config.AbstractPropertyPlaceholderConfigurer; |
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
||||
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; |
||||
import org.springframework.context.EnvironmentAware; |
||||
import org.springframework.core.env.AbstractEnvironment; |
||||
import org.springframework.core.env.ConfigurableEnvironment; |
||||
import org.springframework.core.env.Environment; |
||||
import org.springframework.core.env.PropertiesPropertySource; |
||||
import org.springframework.core.env.PropertySource; |
||||
import org.springframework.util.Assert; |
||||
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; |
||||
|
||||
|
||||
/** |
||||
* TODO SPR-7508: document |
||||
* |
||||
* Local properties are added as a property source in any case. Precedence is based |
||||
* on the value of the {@link #setLocalOverride(boolean) localOverride} property. |
||||
* |
||||
* @author Chris Beams |
||||
* @since 3.1 |
||||
* @see PropertyPlaceholderConfigurer |
||||
* @see EnvironmentAwarePropertyOverrideConfigurer |
||||
*/ |
||||
public class EnvironmentAwarePropertyPlaceholderConfigurer |
||||
extends AbstractPropertyPlaceholderConfigurer implements EnvironmentAware { |
||||
|
||||
private ConfigurableEnvironment environment; |
||||
private Environment wrappedEnvironment; |
||||
|
||||
public void setEnvironment(Environment environment) { |
||||
this.wrappedEnvironment = environment; |
||||
} |
||||
|
||||
@Override |
||||
protected PlaceholderResolver getPlaceholderResolver(Properties props) { |
||||
return new PlaceholderResolver() { |
||||
public String resolvePlaceholder(String placeholderName) { |
||||
return environment.getProperty(placeholderName); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { |
||||
Assert.notNull(this.wrappedEnvironment, "Environment must not be null. Did you call setEnvironment()?"); |
||||
environment = new AbstractEnvironment() { }; |
||||
|
||||
LinkedList<PropertySource<?>> propertySources = environment.getPropertySources(); |
||||
EnvironmentPropertySource environmentPropertySource = |
||||
new EnvironmentPropertySource("wrappedEnvironment", wrappedEnvironment); |
||||
|
||||
if (!this.localOverride) { |
||||
propertySources.add(environmentPropertySource); |
||||
} |
||||
|
||||
if (this.localProperties != null) { |
||||
int cx=0; |
||||
for (Properties localProps : this.localProperties) { |
||||
propertySources.add(new PropertiesPropertySource("localProperties"+cx++, localProps)); |
||||
} |
||||
} |
||||
|
||||
if (this.localOverride) { |
||||
propertySources.add(environmentPropertySource); |
||||
} |
||||
|
||||
super.postProcessBeanFactory(beanFactory); |
||||
} |
||||
|
||||
static class EnvironmentPropertySource extends PropertySource<Environment> { |
||||
|
||||
public EnvironmentPropertySource(String name, Environment source) { |
||||
super(name, source); |
||||
} |
||||
|
||||
@Override |
||||
public boolean containsProperty(String key) { |
||||
return source.containsProperty(key); |
||||
} |
||||
|
||||
@Override |
||||
public String getProperty(String key) { |
||||
return source.getProperty(key); |
||||
} |
||||
|
||||
@Override |
||||
public int size() { |
||||
// TODO Auto-generated method stub
|
||||
return source.getPropertyCount(); |
||||
} |
||||
} |
||||
} |
||||
@ -1,13 +1,17 @@
@@ -1,13 +1,17 @@
|
||||
http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd |
||||
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd |
||||
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd |
||||
http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd |
||||
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.1.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd |
||||
http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd |
||||
http\://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd |
||||
http\://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd |
||||
http\://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd |
||||
http\://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd |
||||
http\://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd |
||||
|
||||
@ -0,0 +1,500 @@
@@ -0,0 +1,500 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/context" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/context" |
||||
elementFormDefault="qualified" attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" /> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd" /> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the configuration elements for the Spring Framework's application |
||||
context support. Effects the activation of various configuration styles |
||||
for the containing Spring ApplicationContext. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:complexType name="propertyPlaceholder"> |
||||
<xsd:attribute name="location" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The location of the properties file to resolve placeholders against, as a Spring |
||||
resource location: a URL, a "classpath:" pseudo URL, or a relative file path. |
||||
Multiple locations may be specified, separated by commas. If neither location nor properties-ref is |
||||
specified, placeholders will be resolved against system properties. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="properties-ref" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.util.Properties"><![CDATA[ |
||||
The bean name of a Java Properties object that will be used for property substitution. |
||||
If neither location nor properties-ref is specified, placeholders will be resolved against system properties. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="file-encoding" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies the encoding to use for parsing properties files. Default is none, |
||||
using the java.util.Properties default encoding. Only applies to classic |
||||
properties files, not to XML files. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="order" type="xsd:integer"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies the order for this placeholder configurer. If more than one is present in a context |
||||
the order can be important since the first one to be match a placeholder will win. Often used |
||||
in conjunction with |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="ignore-resource-not-found" type="xsd:boolean" |
||||
default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies if failure to find the property resource location should be ignored. Default |
||||
is "false", meaning that if there is no file in the location specified an exception will |
||||
be raised at runtime. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="ignore-unresolvable" type="xsd:boolean" |
||||
default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies if failure to find the property value to replace a key should be ignored. Default |
||||
is "false", meaning that this placeholder configurer will raise an exception if it cannot resolve |
||||
a key. Set to "true" to allow the configurer to pass on the key to any others in |
||||
the context that have not yet visited the key in question. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="local-override" type="xsd:boolean" |
||||
default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies whether local properties override properties from files. Default |
||||
is "false": Properties from files override local defaults. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:element name="property-placeholder"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Activates replacement of ${...} placeholders, resolved against the specified properties file or |
||||
Properties object (if any). Defines an EnvironmentAwarePropertyPlaceholderConfigurer within the context. |
||||
For backward compatibility with versions earlier than Spring 3.1, a PropertyPlaceholderConfigurer will be |
||||
registered if the 'system-properties-mode' attribute has been explicitly assigned a value. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports |
||||
type="org.springframework.beans.factory.config.AbstractPropertyPlaceholderConfigurer" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="propertyPlaceholder"> |
||||
<xsd:attribute name="system-properties-mode" default="DELEGATE"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
If set to any value other than DELEGATE, register a PropertyPlaceholderConfigurer bean and call |
||||
its setSystemPropertiesModeName() method with the value. If set to DELEGATE (the default), register |
||||
an EnvironmentAwarePropertyPlaceholderConfigurer and ignore the setting altogether, instead delegating |
||||
to the enclosing application context's Environment object and its collection of PropertySource objects |
||||
which may or may not include system properties and environment variables. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="DELEGATE"/> |
||||
<xsd:enumeration value="NEVER"/> |
||||
<xsd:enumeration value="FALLBACK"/> |
||||
<xsd:enumeration value="OVERRIDE"/> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="property-override"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Activates pushing of override values into bean properties, based on configuration |
||||
lines of the following format: beanName.property=value |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports |
||||
type="org.springframework.beans.factory.config.PropertyOverrideConfigurer" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="propertyPlaceholder" /> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="annotation-config"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Activates various annotations to be detected in bean classes: Spring's @Required and |
||||
@Autowired, as well as JSR 250's @PostConstruct, @PreDestroy and @Resource (if available), |
||||
JAX-WS's @WebServiceRef (if available), EJB3's @EJB (if available), and JPA's |
||||
@PersistenceContext and @PersistenceUnit (if available). Alternatively, you may |
||||
choose to activate the individual BeanPostProcessors for those annotations. |
||||
|
||||
Note: This tag does not activate processing of Spring's @Transactional or EJB3's |
||||
@TransactionAttribute annotation. Consider the use of the <tx:annotation-driven> |
||||
tag for that purpose. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="component-scan"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Scans the classpath for annotated components that will be auto-registered as |
||||
Spring beans. By default, the Spring-provided @Component, @Repository, |
||||
@Service, and @Controller stereotypes will be detected. |
||||
|
||||
Note: This tag implies the effects of the 'annotation-config' tag, activating @Required, |
||||
@Autowired, @PostConstruct, @PreDestroy, @Resource, @PersistenceContext and @PersistenceUnit |
||||
annotations in the component classes, which is usually desired for autodetected components |
||||
(without external configuration). Turn off the 'annotation-config' attribute to deactivate |
||||
this default behavior, for example in order to use custom BeanPostProcessor definitions |
||||
for handling those annotations. |
||||
|
||||
Note: You may use placeholders in package paths, but only resolved against system |
||||
properties (analogous to resource paths). A component scan results in new bean definition |
||||
being registered; Spring's PropertyPlaceholderConfigurer will apply to those bean |
||||
definitions just like to regular bean definitions, but it won't apply to the component |
||||
scan settings themselves. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="include-filter" type="filterType" |
||||
minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls which eligible types to include for component scanning. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="exclude-filter" type="filterType" |
||||
minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls which eligible types to exclude for component scanning. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="base-package" type="xsd:string" |
||||
use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The comma-separated list of packages to scan for annotated components. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="resource-pattern" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls the class files eligible for component detection. Defaults to "**/*.class", the recommended value. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="use-default-filters" type="xsd:boolean" |
||||
default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates whether automatic detection of classes annotated with @Component, @Repository, @Service, |
||||
or @Controller should be enabled. Default is "true". |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="annotation-config" type="xsd:boolean" |
||||
default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates whether the implicit annotation post-processors should be enabled. Default is "true". |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="name-generator" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The fully-qualified class name of the BeanNameGenerator to be used for naming detected components. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class" /> |
||||
<tool:assignable-to |
||||
type="org.springframework.beans.factory.support.BeanNameGenerator" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scope-resolver" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The fully-qualified class name of the ScopeMetadataResolver to be used for resolving the scope of |
||||
detected components. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class" /> |
||||
<tool:assignable-to |
||||
type="org.springframework.context.annotation.ScopeMetadataResolver" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scoped-proxy"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates whether proxies should be generated for detected components, which may be necessary |
||||
when using scopes in a proxy-style fashion. Default is to generate no such proxies. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="no" /> |
||||
<xsd:enumeration value="interfaces" /> |
||||
<xsd:enumeration value="targetClass" /> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="load-time-weaver"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Activates a Spring LoadTimeWeaver for this application context, available as |
||||
a bean with the name "loadTimeWeaver". Any bean that implements the |
||||
LoadTimeWeaverAware interface will then receive the LoadTimeWeaver reference |
||||
automatically; for example, Spring's JPA bootstrap support. |
||||
|
||||
The default weaver is determined automatically. As of Spring 2.5: detecting |
||||
Sun's GlassFish, Oracle's OC4J, Spring's VM agent and any ClassLoader |
||||
supported by Spring's ReflectiveLoadTimeWeaver (for example, the |
||||
TomcatInstrumentableClassLoader). |
||||
|
||||
The activation of AspectJ load-time weaving is specified via a simple flag |
||||
(the 'aspectj-weaving' attribute), with the AspectJ class transformer |
||||
registered through Spring's LoadTimeWeaver. AspectJ weaving will be activated |
||||
by default if a "META-INF/aop.xml" resource is present in the classpath. |
||||
|
||||
This also activates the current application context for applying dependency |
||||
injection to non-managed classes that are instantiated outside of the Spring |
||||
bean factory (typically classes annotated with the @Configurable annotation). |
||||
This will only happen if the AnnotationBeanConfigurerAspect is on the classpath |
||||
(i.e. spring-aspects.jar), effectively activating "spring-configured" by default. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports |
||||
type="org.springframework.instrument.classloading.LoadTimeWeaver" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="weaver-class" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The fully-qualified classname of the LoadTimeWeaver that is to be activated. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class" /> |
||||
<tool:assignable-to |
||||
type="org.springframework.instrument.classloading.LoadTimeWeaver" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="aspectj-weaving" default="autodetect"> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="on"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Switches Spring-based AspectJ load-time weaving on. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:enumeration> |
||||
<xsd:enumeration value="off"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Switches Spring-based AspectJ load-time weaving off. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:enumeration> |
||||
<xsd:enumeration value="autodetect"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Switches AspectJ load-time weaving on if a "META-INF/aop.xml" resource |
||||
is present in the classpath. If there is no such resource, then AspectJ |
||||
load-time weaving will be switched off. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:enumeration> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="spring-configured"> |
||||
<xsd:annotation> |
||||
<xsd:documentation |
||||
source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"> |
||||
<![CDATA[ |
||||
Signals the current application context to apply dependency injection |
||||
to non-managed classes that are instantiated outside of the Spring bean |
||||
factory (typically classes annotated with the @Configurable annotation). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string" /> |
||||
</xsd:simpleType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="mbean-export"> |
||||
<xsd:annotation> |
||||
<xsd:documentation |
||||
source="java:org.springframework.jmx.export.annotation.AnnotationMBeanExporter"><![CDATA[ |
||||
Activates default exporting of MBeans by detecting standard MBeans in the Spring |
||||
context as well as @ManagedResource annotations on Spring-defined beans. |
||||
|
||||
The resulting MBeanExporter bean is defined under the name "mbeanExporter". |
||||
Alternatively, consider defining a custom AnnotationMBeanExporter bean explicitly. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports |
||||
type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="default-domain" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The default domain to use when generating JMX ObjectNames. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="server" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The bean name of the MBeanServer to which MBeans should be exported. |
||||
Default is to use the platform's default MBeanServer (autodetecting |
||||
WebLogic 9+, WebSphere 5.1+ and the JDK 1.5+ platform MBeanServer). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="registration"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The registration behavior, indicating how to deal with existing MBeans |
||||
of the same name: fail with an exception, ignore and keep the existing |
||||
MBean, or replace the existing one with the new MBean. |
||||
|
||||
Default is to fail with an exception. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:NMTOKEN"> |
||||
<xsd:enumeration value="failOnExisting" /> |
||||
<xsd:enumeration value="ignoreExisting" /> |
||||
<xsd:enumeration value="replaceExisting" /> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="mbean-server"> |
||||
<xsd:annotation> |
||||
<xsd:documentation |
||||
source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[ |
||||
Exposes a default MBeanServer for the current platform. |
||||
Autodetects WebLogic 9+, WebSphere 6.1+ and the JDK 1.5+ platform MBeanServer. |
||||
|
||||
The default bean name for the exposed MBeanServer is "mbeanServer". |
||||
This may be customized through specifying the "id" attribute. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:exports type="javax.management.MBeanServer" /> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:identifiedType"> |
||||
<xsd:attribute name="agent-id" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The agent id of the target MBeanServer, if any. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:complexType name="filterType"> |
||||
<xsd:attribute name="type" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls the type of filtering to apply to the expression. |
||||
|
||||
"annotation" indicates an annotation to be present at the type level in target components; |
||||
"assignable" indicates a class (or interface) that the target components are assignable to (extend/implement); |
||||
"aspectj" indicates an AspectJ type expression to be matched by the target components; |
||||
"regex" indicates a regex expression to be matched by the target components' class names; |
||||
"custom" indicates a custom implementation of the org.springframework.core.type.TypeFilter interface. |
||||
|
||||
Note: This attribute will not be inherited by child bean definitions. |
||||
Hence, it needs to be specified per concrete bean definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="annotation" /> |
||||
<xsd:enumeration value="assignable" /> |
||||
<xsd:enumeration value="aspectj" /> |
||||
<xsd:enumeration value="regex" /> |
||||
<xsd:enumeration value="custom" /> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expression" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Indicates the filter expression, the type of which is indicated by "type". |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
</xsd:schema> |
||||
@ -0,0 +1,254 @@
@@ -0,0 +1,254 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/jee" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/jee" |
||||
elementFormDefault="qualified" |
||||
attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines configuration elements for access to traditional Java EE components |
||||
such as JNDI resources and EJB session beans. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:element name="jndi-lookup"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.jndi.JndiObjectFactoryBean"><![CDATA[ |
||||
Exposes an object reference via a JNDI lookup. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="jndiLocatingType"> |
||||
<xsd:attribute name="cache" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether the object returned from the JNDI lookup is cached |
||||
after the first lookup. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expected-type" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The type that the located JNDI object is supposed to be assignable |
||||
to, if indeed any. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="lookup-on-startup" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether the JNDI lookup is performed immediately on startup |
||||
(if true, the default), or on first access (if false). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="proxy-interface" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The proxy interface to use for the JNDI object. |
||||
|
||||
Needs to be specified because the actual JNDI object type is not |
||||
known in advance in case of a lazy lookup. |
||||
|
||||
Typically used in conjunction with "lookupOnStartup"=false and/or |
||||
"cache"=false. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-type type="java.lang.Class"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="default-value" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specify a default literal value to fall back to if the JNDI lookup fails. |
||||
This is typically used for literal values in scenarios where the JNDI environment |
||||
might define specific config settings but those are not required to be present. |
||||
|
||||
Default is none. Note: This is only supported for lookup on startup. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="default-ref" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specify a default bean reference to fall back to if the JNDI lookup fails. |
||||
This might for example point to a local fallback DataSource. |
||||
|
||||
Default is none. Note: This is only supported for lookup on startup. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="local-slsb" type="ejbType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean"><![CDATA[ |
||||
Exposes a reference to a local EJB Stateless SessionBean. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="remote-slsb"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"><![CDATA[ |
||||
Exposes a reference to a remote EJB Stateless SessionBean. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="ejbType"> |
||||
<xsd:attribute name="home-interface" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The home interface that will be narrowed to before performing |
||||
the parameterless SLSB create() call that returns the actual |
||||
SLSB proxy. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="refresh-home-on-connect-failure" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether to refresh the EJB home on connect failure. |
||||
|
||||
Can be turned on to allow for hot restart of the EJB server. |
||||
If a cached EJB home throws an RMI exception that indicates a |
||||
remote connect failure, a fresh home will be fetched and the |
||||
invocation will be retried. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="cache-session-bean" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether to cache the actual session bean object. |
||||
|
||||
Off by default for standard EJB compliance. Turn this flag |
||||
on to optimize session bean access for servers that are |
||||
known to allow for caching the actual session bean object. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<!-- base types --> |
||||
<xsd:complexType name="jndiLocatingType" abstract="true"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:identifiedType"> |
||||
<xsd:sequence> |
||||
<xsd:element name="environment" minOccurs="0" maxOccurs="1"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The newline-separated, key-value pairs for the JNDI environment |
||||
(in standard Properties format, namely 'key=value' pairs) |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"/> |
||||
</xsd:simpleType> |
||||
</xsd:element> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="environment-ref" type="environmentRefType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A reference to JNDI environment properties, indicating the name of a |
||||
shared bean of type [java.util.Properties}. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="jndi-name" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The JNDI name to look up. This may be a fully-qualified JNDI path |
||||
or a local Java EE environment naming context path in which case the |
||||
prefix "java:comp/env/" will be prepended if applicable. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="resource-ref" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether the lookup occurs in a Java EE container, i.e. if the |
||||
prefix "java:comp/env/" needs to be added if the JNDI name doesn't |
||||
already contain it. Default is "true" (since Spring 2.5). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="expose-access-context" type="xsd:boolean" default="false"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Set whether to expose the JNDI environment context for all access to the target |
||||
EJB, i.e. for all method invocations on the exposed object reference. |
||||
Default is "false", i.e. to only expose the JNDI context for object lookup. |
||||
|
||||
Switch this flag to "true" in order to expose the JNDI environment (including |
||||
the authorization context) for each EJB invocation, as needed by WebLogic |
||||
for EJBs with authorization requirements. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="ejbType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="jndiLocatingType"> |
||||
<xsd:attribute name="lookup-home-on-startup" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether the lookup of the EJB home object is performed |
||||
immediately on startup (if true, the default), or on first access |
||||
(if false). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="cache-home" type="xsd:boolean" default="true"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Controls whether the EJB home object is cached once it has been located. |
||||
On by default; turn this flag off to always reobtain fresh home objects. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="business-interface" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The business interface of the EJB being proxied. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:simpleType name="environmentRefType"> |
||||
<xsd:annotation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"> |
||||
<tool:expected-type type="java.util.Properties"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
<xsd:union memberTypes="xsd:string"/> |
||||
</xsd:simpleType> |
||||
|
||||
</xsd:schema> |
||||
@ -0,0 +1,233 @@
@@ -0,0 +1,233 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/task" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/task" |
||||
elementFormDefault="qualified" |
||||
attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the elements used in the Spring Framework's support for task execution and scheduling. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/> |
||||
|
||||
<xsd:element name="annotation-driven"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Enables the detection of @Async and @Scheduled annotations on any Spring-managed object. If present, |
||||
a proxy will be generated for executing the annotated methods asynchronously. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="executor" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies the java.util.Executor instance to use when invoking asynchronous methods. |
||||
If not provided, an instance of org.springframework.core.task.SimpleAsyncTaskExecutor |
||||
will be used by default |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="scheduler" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Specifies the org.springframework.scheduling.TaskScheduler or |
||||
java.util.ScheduledExecutorService instance to use when invoking scheduled |
||||
methods. If no reference is provided, a TaskScheduler backed by a single |
||||
thread scheduled executor will be used. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="scheduler"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines a ThreadPoolTaskScheduler instance with configurable pool size. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="id" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The bean name for the generated ThreadPoolTaskScheduler instance. |
||||
It will also be used as the default thread name prefix. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="pool-size" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The size of the ScheduledExecutorService's thread pool. The default is 1. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="executor"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines a ThreadPoolTaskExecutor instance with configurable pool size, |
||||
queue-capacity, keep-alive, and rejection-policy values. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="id" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The bean name for the generated ThreadPoolTaskExecutor instance. |
||||
This value will also be used as the thread name prefix which is why it is |
||||
required even when defining the executor as an inner bean: The executor |
||||
won't be directly accessible then but will nevertheless use the specified |
||||
id as the thread name prefix of the threads that it manages. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="pool-size" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The size of the executor's thread pool as either a single value or a range |
||||
(e.g. 5-10). If no bounded queue-capacity value is provided, then a max value |
||||
has no effect unless the range is specified as 0-n. In that case, the core pool |
||||
will have a size of n, but the 'allowCoreThreadTimeout' flag will be set to true. |
||||
If a queue-capacity is provided, then the lower bound of a range will map to the |
||||
core size and the upper bound will map to the max size. If this attribute is not |
||||
provided, the default core size will be 1, and the default max size will be |
||||
Integer.MAX_VALUE (i.e. unbounded). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="queue-capacity" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Queue capacity for the ThreadPoolTaskExecutor. If not specified, the default will |
||||
be Integer.MAX_VALUE (i.e. unbounded). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="keep-alive" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Keep-alive time in seconds. Inactive threads that have been created beyond the |
||||
core size will timeout after the specified number of seconds elapse. If the |
||||
executor has an unbounded queue capacity and a size range represented as 0-n, |
||||
then the core threads will also be configured to timeout when inactive. |
||||
Otherwise, core threads will not ever timeout. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="rejection-policy" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The RejectedExecutionHandler type. When a bounded queue cannot accept any |
||||
additional tasks, this determines the behavior. While the default is ABORT, |
||||
consider using CALLER_RUNS to throttle inbound tasks. In other words, by forcing |
||||
the caller to run the task itself, it will not be able to provide another task |
||||
until after it completes the task at hand. In the meantime, one or more tasks |
||||
may be removed from the queue. Alternatively, if it is not critical to run every |
||||
task, consider using DISCARD to drop the current task or DISCARD_OLDEST to drop |
||||
the task at the head of the queue. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:string"> |
||||
<xsd:enumeration value="ABORT"/> |
||||
<xsd:enumeration value="CALLER_RUNS"/> |
||||
<xsd:enumeration value="DISCARD"/> |
||||
<xsd:enumeration value="DISCARD_OLDEST"/> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="scheduled-tasks"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Top-level element that contains one or more task sub-elements to be |
||||
managed by a given TaskScheduler. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="scheduled" type="scheduledTaskType" minOccurs="1" maxOccurs="unbounded"/> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="scheduler" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Reference to an instance of TaskScheduler to manage the provided tasks. If not specified, |
||||
the default value will be a wrapper for a single-threaded Executor. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref"> |
||||
<tool:expected-type type="org.springframework.scheduling.TaskScheduler"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:complexType name="scheduledTaskType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Element defining a scheduled method-invoking task and its corresponding trigger. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:attribute name="cron" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A cron-based trigger. See the org.springframework.scheduling.support.CronSequenceGenerator |
||||
JavaDoc for example patterns. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="fixed-delay" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An interval-based trigger where the interval is measured from the completion time of the |
||||
previous task. The time unit value is measured in milliseconds. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="fixed-rate" type="xsd:string" use="optional"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
An interval-based trigger where the interval is measured from the start time of the |
||||
previous task. The time unit value is measured in milliseconds. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="ref" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Reference to an object that provides a method to be invoked. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation kind="ref" /> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="method" type="xsd:string" use="required"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of the method to be invoked. |
||||
]]></xsd:documentation> |
||||
<xsd:appinfo> |
||||
<tool:annotation> |
||||
<tool:expected-method type-ref="@ref"/> |
||||
</tool:annotation> |
||||
</xsd:appinfo> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:complexType> |
||||
|
||||
</xsd:schema> |
||||
@ -0,0 +1,199 @@
@@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/lang" |
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
||||
xmlns:beans="http://www.springframework.org/schema/beans" |
||||
xmlns:tool="http://www.springframework.org/schema/tool" |
||||
targetNamespace="http://www.springframework.org/schema/lang" |
||||
elementFormDefault="qualified" |
||||
attributeFormDefault="unqualified"> |
||||
|
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Defines the elements used in the Spring Framework's dynamic language |
||||
support, which allows bean definitions that are backed by classes |
||||
written in a language other than Java. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> |
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/> |
||||
|
||||
<xsd:element name="defaults"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Default settings for any scripted beans registered within this context. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:complexType> |
||||
<xsd:attributeGroup ref="defaultableAttributes"/> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="groovy" type="customizableScriptType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A Spring bean backed by a Groovy class definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="jruby" type="dynamicScriptType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A Spring bean backed by a JRuby class definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
|
||||
<xsd:element name="bsh" type="dynamicScriptType"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
A Spring bean backed by a BeanShell script. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
|
||||
<!-- Script Types --> |
||||
<xsd:complexType name="simpleScriptType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="beans:identifiedType"> |
||||
<xsd:sequence> |
||||
<xsd:element name="inline-script" minOccurs="0" maxOccurs="1"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The source code for the dynamic language-backed bean. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
<xsd:element name="property" type="beans:propertyType" minOccurs="0" maxOccurs="unbounded"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Dynamic language-backed bean definitions can have zero or more properties. |
||||
Property elements correspond to JavaBean setter methods exposed |
||||
by the bean classes. Spring supports primitives, references to other |
||||
beans in the same or related factories, lists, maps and properties. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:element> |
||||
</xsd:sequence> |
||||
<xsd:attributeGroup ref="defaultableAttributes"/> |
||||
<xsd:attribute name="script-source" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:org.springframework.core.io.Resource"><![CDATA[ |
||||
The resource containing the script for the dynamic language-backed bean. |
||||
|
||||
Examples might be '/WEB-INF/scripts/Anais.groovy', 'classpath:Nin.bsh', etc. |
||||
]]></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[ |
||||
The scope of this scripted bean: typically "singleton" (one shared instance, |
||||
which will be returned by all calls to getBean with the given id), or |
||||
"prototype" (independent instance resulting from each call to getBean). |
||||
Default is "singleton". |
||||
|
||||
Singletons are most commonly used, and are ideal for multi-threaded |
||||
service objects. Further scopes, such as "request" or "session", might |
||||
be supported by extended bean factories (e.g. in a web environment). |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="autowire" default="default"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The autowire mode for the scripted bean. |
||||
Analogous to the 'autowire' attribute on a standard bean definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
<xsd:simpleType> |
||||
<xsd:restriction base="xsd:NMTOKEN"> |
||||
<xsd:enumeration value="default"/> |
||||
<xsd:enumeration value="no"/> |
||||
<xsd:enumeration value="byName"/> |
||||
<xsd:enumeration value="byType"/> |
||||
</xsd:restriction> |
||||
</xsd:simpleType> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="depends-on" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The names of the beans that this bean depends on being initialized. |
||||
The bean factory will guarantee that these beans get initialized |
||||
before this bean. |
||||
|
||||
Note that dependencies are normally expressed through bean properties. |
||||
This property should just be necessary other kinds of dependencies |
||||
like statics (*ugh*) or database preparation on startup. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="init-method" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of an initialization method defined on the scripted bean. |
||||
Analogous to the 'init-method' attribute on a standard bean definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
<xsd:attribute name="destroy-method" type="xsd:string"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The name of a destruction method defined on the scripted bean. |
||||
Analogous to the 'destroy-method' attribute on a standard bean definition. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="dynamicScriptType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="simpleScriptType"> |
||||
<xsd:attribute name="script-interfaces"> |
||||
<xsd:annotation> |
||||
<xsd:documentation source="java:java.lang.Class"><![CDATA[ |
||||
The Java interfaces that the dynamic language-backed object is to expose; comma-delimited. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:complexType name="customizableScriptType"> |
||||
<xsd:complexContent> |
||||
<xsd:extension base="simpleScriptType"> |
||||
<xsd:attribute name="customizer-ref"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
Reference to a GroovyObjectCustomizer or similar customizer bean. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:extension> |
||||
</xsd:complexContent> |
||||
</xsd:complexType> |
||||
|
||||
<xsd:attributeGroup name="defaultableAttributes"> |
||||
<xsd:attribute name="refresh-check-delay" type="xsd:long"> |
||||
<xsd:annotation> |
||||
<xsd:documentation><![CDATA[ |
||||
The delay (in milliseconds) between checks for updated sources when |
||||
using the refreshable beans feature. |
||||
]]></xsd:documentation> |
||||
</xsd:annotation> |
||||
</xsd:attribute> |
||||
</xsd:attributeGroup> |
||||
|
||||
</xsd:schema> |
||||
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package example.profilescan; |
||||
|
||||
import org.springframework.context.annotation.Profile; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Profile(ProfileAnnotatedComponent.PROFILE_NAME) |
||||
@Component(ProfileAnnotatedComponent.BEAN_NAME) |
||||
public class ProfileAnnotatedComponent { |
||||
|
||||
public static final String BEAN_NAME = "profileAnnotatedComponent"; |
||||
public static final String PROFILE_NAME = "test"; |
||||
|
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue