Skip to content

Commit 7994b63

Browse files
committed
Polishing
1 parent 26e697b commit 7994b63

File tree

4 files changed

+85
-110
lines changed

4 files changed

+85
-110
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
4242
* always registered, meaning that any attempt to disable them at the
4343
* {@code @ComponentScan} level would be ignored.
4444
*
45-
* <p>See @{@link Configuration} Javadoc for usage examples.
45+
* <p>See @{@link Configuration}'s javadoc for usage examples.
4646
*
4747
* @author Chris Beams
4848
* @since 3.1
@@ -139,24 +139,18 @@
139139
@Retention(RetentionPolicy.RUNTIME)
140140
@Target({})
141141
@interface Filter {
142+
142143
/**
143-
* The type of filter to use.
144-
* <p>Note that the filter types available are limited to those that may
145-
* be expressed as a {@code Class} in the {@link #value()} attribute. This is
146-
* in contrast to {@code <context:component-scan/>}, which allows for
147-
* expression-based (i.e., string-based) filters such as AspectJ pointcuts.
148-
* These filter types are intentionally not supported here, and not available
149-
* in the {@link FilterType} enum.
150-
* @see FilterType
144+
* The type of filter to use. Default is {@link FilterType#ANNOTATION}.
151145
*/
152146
FilterType type() default FilterType.ANNOTATION;
153147

154148
/**
155149
* The class or classes to use as the filter. In the case of
156-
* {@link FilterType#ANNOTATION}, the class will be the annotation itself. In the
157-
* case of {@link FilterType#ASSIGNABLE_TYPE}, the class will be the type that
158-
* detected components should be assignable to. And in the case of
159-
* {@link FilterType#CUSTOM}, the class will be an implementation of
150+
* {@link FilterType#ANNOTATION}, the class will be the annotation itself.
151+
* In the case of {@link FilterType#ASSIGNABLE_TYPE}, the class will be the
152+
* type that detected components should be assignable to. And in the case
153+
* of {@link FilterType#CUSTOM}, the class will be an implementation of
160154
* {@link TypeFilter}.
161155
* <p>When multiple classes are specified, OR logic is applied, e.g. "include
162156
* types annotated with {@code @Foo} OR {@code @Bar}".

spring-context/src/main/java/org/springframework/context/annotation/FilterType.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,9 +16,6 @@
1616

1717
package org.springframework.context.annotation;
1818

19-
import org.springframework.core.type.filter.AssignableTypeFilter;
20-
21-
2219
/**
2320
* Enumeration of the type filters that may be used in conjunction with
2421
* {@link ComponentScan @ComponentScan}.
@@ -42,12 +39,12 @@ public enum FilterType {
4239

4340
/**
4441
* Filter candidates assignable to a given type.
45-
* @see AssignableTypeFilter
42+
* @see org.springframework.core.type.filter.AssignableTypeFilter
4643
*/
4744
ASSIGNABLE_TYPE,
4845

4946
/** Filter candidates using a given custom
50-
* {@link org.springframework.core.type.filter.TypeFilter} implementation
47+
* {@link org.springframework.core.type.filter.TypeFilter} implementation.
5148
*/
5249
CUSTOM
5350

spring-context/src/main/resources/org/springframework/context/config/spring-context-3.1.xsd

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<xsd:schema xmlns="http://www.springframework.org/schema/context"
4-
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans"
5-
xmlns:tool="http://www.springframework.org/schema/tool"
6-
targetNamespace="http://www.springframework.org/schema/context"
7-
elementFormDefault="qualified" attributeFormDefault="unqualified">
4+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5+
xmlns:beans="http://www.springframework.org/schema/beans"
6+
xmlns:tool="http://www.springframework.org/schema/tool"
7+
targetNamespace="http://www.springframework.org/schema/context"
8+
elementFormDefault="qualified"
9+
attributeFormDefault="unqualified">
810

9-
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" />
10-
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd" />
11+
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"/>
12+
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.1.xsd"/>
1113

1214
<xsd:annotation>
1315
<xsd:documentation><![CDATA[
@@ -107,7 +109,7 @@
107109
<xsd:appinfo>
108110
<tool:annotation>
109111
<tool:exports
110-
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer" />
112+
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
111113
</tool:annotation>
112114
</xsd:appinfo>
113115
</xsd:annotation>
@@ -158,14 +160,13 @@
158160
]]></xsd:documentation>
159161
<xsd:appinfo>
160162
<tool:annotation>
161-
<tool:exports
162-
type="org.springframework.beans.factory.config.PropertyOverrideConfigurer" />
163+
<tool:exports type="org.springframework.beans.factory.config.PropertyOverrideConfigurer"/>
163164
</tool:annotation>
164165
</xsd:appinfo>
165166
</xsd:annotation>
166167
<xsd:complexType>
167168
<xsd:complexContent>
168-
<xsd:extension base="propertyPlaceholder" />
169+
<xsd:extension base="propertyPlaceholder"/>
169170
</xsd:complexContent>
170171
</xsd:complexType>
171172
</xsd:element>
@@ -273,9 +274,8 @@
273274
]]></xsd:documentation>
274275
<xsd:appinfo>
275276
<tool:annotation>
276-
<tool:expected-type type="java.lang.Class" />
277-
<tool:assignable-to
278-
type="org.springframework.beans.factory.support.BeanNameGenerator" />
277+
<tool:expected-type type="java.lang.Class"/>
278+
<tool:assignable-to type="org.springframework.beans.factory.support.BeanNameGenerator"/>
279279
</tool:annotation>
280280
</xsd:appinfo>
281281
</xsd:annotation>
@@ -288,9 +288,8 @@
288288
]]></xsd:documentation>
289289
<xsd:appinfo>
290290
<tool:annotation>
291-
<tool:expected-type type="java.lang.Class" />
292-
<tool:assignable-to
293-
type="org.springframework.context.annotation.ScopeMetadataResolver" />
291+
<tool:expected-type type="java.lang.Class"/>
292+
<tool:assignable-to type="org.springframework.context.annotation.ScopeMetadataResolver"/>
294293
</tool:annotation>
295294
</xsd:appinfo>
296295
</xsd:annotation>
@@ -304,9 +303,9 @@
304303
</xsd:annotation>
305304
<xsd:simpleType>
306305
<xsd:restriction base="xsd:string">
307-
<xsd:enumeration value="no" />
308-
<xsd:enumeration value="interfaces" />
309-
<xsd:enumeration value="targetClass" />
306+
<xsd:enumeration value="no"/>
307+
<xsd:enumeration value="interfaces"/>
308+
<xsd:enumeration value="targetClass"/>
310309
</xsd:restriction>
311310
</xsd:simpleType>
312311
</xsd:attribute>
@@ -342,8 +341,7 @@
342341
]]></xsd:documentation>
343342
<xsd:appinfo>
344343
<tool:annotation>
345-
<tool:exports
346-
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
344+
<tool:exports type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
347345
</tool:annotation>
348346
</xsd:appinfo>
349347
</xsd:annotation>
@@ -355,9 +353,8 @@
355353
]]></xsd:documentation>
356354
<xsd:appinfo>
357355
<tool:annotation>
358-
<tool:expected-type type="java.lang.Class" />
359-
<tool:assignable-to
360-
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
356+
<tool:expected-type type="java.lang.Class"/>
357+
<tool:assignable-to type="org.springframework.instrument.classloading.LoadTimeWeaver"/>
361358
</tool:annotation>
362359
</xsd:appinfo>
363360
</xsd:annotation>
@@ -396,23 +393,20 @@
396393

397394
<xsd:element name="spring-configured">
398395
<xsd:annotation>
399-
<xsd:documentation
400-
source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect">
401-
<![CDATA[
396+
<xsd:documentation source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"><![CDATA[
402397
Signals the current application context to apply dependency injection
403398
to non-managed classes that are instantiated outside of the Spring bean
404399
factory (typically classes annotated with the @Configurable annotation).
405400
]]></xsd:documentation>
406401
</xsd:annotation>
407402
<xsd:simpleType>
408-
<xsd:restriction base="xsd:string" />
403+
<xsd:restriction base="xsd:string"/>
409404
</xsd:simpleType>
410405
</xsd:element>
411406

412407
<xsd:element name="mbean-export">
413408
<xsd:annotation>
414-
<xsd:documentation
415-
source="java:org.springframework.jmx.export.annotation.AnnotationMBeanExporter"><![CDATA[
409+
<xsd:documentation source="java:org.springframework.jmx.export.annotation.AnnotationMBeanExporter"><![CDATA[
416410
Activates default exporting of MBeans by detecting standard MBeans in the Spring
417411
context as well as @ManagedResource annotations on Spring-defined beans.
418412
@@ -421,8 +415,7 @@
421415
]]></xsd:documentation>
422416
<xsd:appinfo>
423417
<tool:annotation>
424-
<tool:exports
425-
type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />
418+
<tool:exports type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter"/>
426419
</tool:annotation>
427420
</xsd:appinfo>
428421
</xsd:annotation>
@@ -455,9 +448,9 @@
455448
</xsd:annotation>
456449
<xsd:simpleType>
457450
<xsd:restriction base="xsd:NMTOKEN">
458-
<xsd:enumeration value="failOnExisting" />
459-
<xsd:enumeration value="ignoreExisting" />
460-
<xsd:enumeration value="replaceExisting" />
451+
<xsd:enumeration value="failOnExisting"/>
452+
<xsd:enumeration value="ignoreExisting"/>
453+
<xsd:enumeration value="replaceExisting"/>
461454
</xsd:restriction>
462455
</xsd:simpleType>
463456
</xsd:attribute>
@@ -466,8 +459,7 @@
466459

467460
<xsd:element name="mbean-server">
468461
<xsd:annotation>
469-
<xsd:documentation
470-
source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[
462+
<xsd:documentation source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[
471463
Exposes a default MBeanServer for the current platform.
472464
Autodetects WebLogic 9+, WebSphere 6.1+ and the JDK 1.5+ platform MBeanServer.
473465
@@ -476,7 +468,7 @@
476468
]]></xsd:documentation>
477469
<xsd:appinfo>
478470
<tool:annotation>
479-
<tool:exports type="javax.management.MBeanServer" />
471+
<tool:exports type="javax.management.MBeanServer"/>
480472
</tool:annotation>
481473
</xsd:appinfo>
482474
</xsd:annotation>
@@ -503,8 +495,8 @@
503495
504496
"annotation" indicates an annotation to be present at the type level in target components;
505497
"assignable" indicates a class (or interface) that the target components are assignable to (extend/implement);
506-
"aspectj" indicates an AspectJ type expression to be matched by the target components;
507-
"regex" indicates a regex expression to be matched by the target components' class names;
498+
"aspectj" indicates an AspectJ type pattern expression to be matched by the target components;
499+
"regex" indicates a regex pattern to be matched by the target components' class names;
508500
"custom" indicates a custom implementation of the org.springframework.core.type.TypeFilter interface.
509501
510502
Note: This attribute will not be inherited by child bean definitions.
@@ -513,11 +505,11 @@
513505
</xsd:annotation>
514506
<xsd:simpleType>
515507
<xsd:restriction base="xsd:string">
516-
<xsd:enumeration value="annotation" />
517-
<xsd:enumeration value="assignable" />
518-
<xsd:enumeration value="aspectj" />
519-
<xsd:enumeration value="regex" />
520-
<xsd:enumeration value="custom" />
508+
<xsd:enumeration value="annotation"/>
509+
<xsd:enumeration value="assignable"/>
510+
<xsd:enumeration value="aspectj"/>
511+
<xsd:enumeration value="regex"/>
512+
<xsd:enumeration value="custom"/>
521513
</xsd:restriction>
522514
</xsd:simpleType>
523515
</xsd:attribute>

0 commit comments

Comments
 (0)