Polishing

This commit is contained in:
Juergen Hoeller
2013-09-26 21:38:54 +02:00
parent 26e697b60c
commit 7994b63c13
4 changed files with 85 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -42,7 +42,7 @@ import org.springframework.core.type.filter.TypeFilter;
* always registered, meaning that any attempt to disable them at the
* {@code @ComponentScan} level would be ignored.
*
* <p>See @{@link Configuration} Javadoc for usage examples.
* <p>See @{@link Configuration}'s javadoc for usage examples.
*
* @author Chris Beams
* @since 3.1
@@ -139,24 +139,18 @@ public @interface ComponentScan {
@Retention(RetentionPolicy.RUNTIME)
@Target({})
@interface Filter {
/**
* The type of filter to use.
* <p>Note that the filter types available are limited to those that may
* be expressed as a {@code Class} in the {@link #value()} attribute. This is
* in contrast to {@code <context:component-scan/>}, which allows for
* expression-based (i.e., string-based) filters such as AspectJ pointcuts.
* These filter types are intentionally not supported here, and not available
* in the {@link FilterType} enum.
* @see FilterType
* The type of filter to use. Default is {@link FilterType#ANNOTATION}.
*/
FilterType type() default FilterType.ANNOTATION;
/**
* The class or classes to use as the filter. In the case of
* {@link FilterType#ANNOTATION}, the class will be the annotation itself. In the
* case of {@link FilterType#ASSIGNABLE_TYPE}, the class will be the type that
* detected components should be assignable to. And in the case of
* {@link FilterType#CUSTOM}, the class will be an implementation of
* {@link FilterType#ANNOTATION}, the class will be the annotation itself.
* In the case of {@link FilterType#ASSIGNABLE_TYPE}, the class will be the
* type that detected components should be assignable to. And in the case
* of {@link FilterType#CUSTOM}, the class will be an implementation of
* {@link TypeFilter}.
* <p>When multiple classes are specified, OR logic is applied, e.g. "include
* types annotated with {@code @Foo} OR {@code @Bar}".

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2013 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.
@@ -16,9 +16,6 @@
package org.springframework.context.annotation;
import org.springframework.core.type.filter.AssignableTypeFilter;
/**
* Enumeration of the type filters that may be used in conjunction with
* {@link ComponentScan @ComponentScan}.
@@ -42,12 +39,12 @@ public enum FilterType {
/**
* Filter candidates assignable to a given type.
* @see AssignableTypeFilter
* @see org.springframework.core.type.filter.AssignableTypeFilter
*/
ASSIGNABLE_TYPE,
/** Filter candidates using a given custom
* {@link org.springframework.core.type.filter.TypeFilter} implementation
* {@link org.springframework.core.type.filter.TypeFilter} implementation.
*/
CUSTOM

View File

@@ -1,13 +1,15 @@
<?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">
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: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[
@@ -107,7 +109,7 @@
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer" />
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -158,14 +160,13 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.beans.factory.config.PropertyOverrideConfigurer" />
<tool:exports type="org.springframework.beans.factory.config.PropertyOverrideConfigurer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="propertyPlaceholder" />
<xsd:extension base="propertyPlaceholder"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
@@ -273,9 +274,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.beans.factory.support.BeanNameGenerator" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.beans.factory.support.BeanNameGenerator"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -288,9 +288,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.context.annotation.ScopeMetadataResolver" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.context.annotation.ScopeMetadataResolver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -304,9 +303,9 @@
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="no" />
<xsd:enumeration value="interfaces" />
<xsd:enumeration value="targetClass" />
<xsd:enumeration value="no"/>
<xsd:enumeration value="interfaces"/>
<xsd:enumeration value="targetClass"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
@@ -342,8 +341,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
<tool:exports type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -355,9 +353,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -396,23 +393,20 @@
<xsd:element name="spring-configured">
<xsd:annotation>
<xsd:documentation
source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect">
<![CDATA[
<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: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[
<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.
@@ -421,8 +415,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />
<tool:exports type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -455,9 +448,9 @@
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="failOnExisting" />
<xsd:enumeration value="ignoreExisting" />
<xsd:enumeration value="replaceExisting" />
<xsd:enumeration value="failOnExisting"/>
<xsd:enumeration value="ignoreExisting"/>
<xsd:enumeration value="replaceExisting"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
@@ -466,8 +459,7 @@
<xsd:element name="mbean-server">
<xsd:annotation>
<xsd:documentation
source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[
<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.
@@ -476,7 +468,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="javax.management.MBeanServer" />
<tool:exports type="javax.management.MBeanServer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -503,8 +495,8 @@
"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;
"aspectj" indicates an AspectJ type pattern expression to be matched by the target components;
"regex" indicates a regex pattern 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.
@@ -513,11 +505,11 @@
</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: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>

View File

@@ -1,13 +1,15 @@
<?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">
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.2.xsd" />
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.2.xsd" />
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"/>
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.2.xsd"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
@@ -107,7 +109,7 @@
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer" />
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -158,14 +160,13 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.beans.factory.config.PropertyOverrideConfigurer" />
<tool:exports type="org.springframework.beans.factory.config.PropertyOverrideConfigurer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="propertyPlaceholder" />
<xsd:extension base="propertyPlaceholder"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
@@ -273,9 +274,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.beans.factory.support.BeanNameGenerator" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.beans.factory.support.BeanNameGenerator"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -288,9 +288,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.context.annotation.ScopeMetadataResolver" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.context.annotation.ScopeMetadataResolver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -304,9 +303,9 @@
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="no" />
<xsd:enumeration value="interfaces" />
<xsd:enumeration value="targetClass" />
<xsd:enumeration value="no"/>
<xsd:enumeration value="interfaces"/>
<xsd:enumeration value="targetClass"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
@@ -342,8 +341,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
<tool:exports type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -355,9 +353,8 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:expected-type type="java.lang.Class" />
<tool:assignable-to
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
<tool:expected-type type="java.lang.Class"/>
<tool:assignable-to type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -396,23 +393,20 @@
<xsd:element name="spring-configured">
<xsd:annotation>
<xsd:documentation
source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect">
<![CDATA[
<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: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[
<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.
@@ -421,8 +415,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports
type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />
<tool:exports type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -455,9 +448,9 @@
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="failOnExisting" />
<xsd:enumeration value="ignoreExisting" />
<xsd:enumeration value="replaceExisting" />
<xsd:enumeration value="failOnExisting"/>
<xsd:enumeration value="ignoreExisting"/>
<xsd:enumeration value="replaceExisting"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
@@ -466,8 +459,7 @@
<xsd:element name="mbean-server">
<xsd:annotation>
<xsd:documentation
source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[
<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.
@@ -476,7 +468,7 @@
]]></xsd:documentation>
<xsd:appinfo>
<tool:annotation>
<tool:exports type="javax.management.MBeanServer" />
<tool:exports type="javax.management.MBeanServer"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
@@ -503,8 +495,8 @@
"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;
"aspectj" indicates an AspectJ type pattern expression to be matched by the target components;
"regex" indicates a regex pattern 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.
@@ -513,11 +505,11 @@
</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: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>