diff --git a/org.springframework.context/.classpath b/org.springframework.context/.classpath index 547fd718196..74ecd49c7de 100644 --- a/org.springframework.context/.classpath +++ b/org.springframework.context/.classpath @@ -9,6 +9,8 @@ + + diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java index cda9f937fa2..978fe2d890c 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java @@ -21,8 +21,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.springframework.context.annotation.Scope; - /** * Indicates that a method produces a bean to be managed by the Spring container. The @@ -59,6 +57,9 @@ import org.springframework.context.annotation.Scope; * @author Chris Beams * @since 3.0 * @see Configuration + * @see Lazy + * @see Primary + * @see Scope */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @@ -98,6 +99,5 @@ public @interface Bean { // TODO: test @Lazy @Bean // TODO: test @Primary @Bean -// TODO: test Bean alias scenarios // TODO: test init/destroy method scenarios // TODO: test dependsOn diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java index 4cdcd961e96..d62f7374bc5 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -22,8 +22,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.springframework.beans.factory.annotation.Autowire; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -32,9 +32,10 @@ import org.springframework.stereotype.Component; * by the Spring container to generate bean definitions and service requests for those beans * at runtime. * - *

Configuration is itself annotated as a {@link Component}, therefore Configuration + *

Configuration is meta-annotated as a {@link Component}, therefore Configuration * classes are candidates for component-scanning and may also take advantage of - * {@link Autowire} at the field and method and constructor level. + * {@link Autowired} at the field, method and constructor level. Externalized values + * may be wired into Configuration classes using the {@link Value} annotation. * *

May be used in conjunction with the {@link Lazy} annotation to indicate that all Bean * methods declared within this class are by default lazily initialized. @@ -43,17 +44,17 @@ import org.springframework.stereotype.Component; *

    *
  • Configuration classes must be non-final *
  • Configuration classes must be non-local (may not be declared within a method) - *
  • Configuration classes must have a default/no-arg constructor or an + *
  • Configuration classes must have a default/no-arg constructor or at least one * {@link Autowired} constructor *
* - * * @author Rod Johnson * @author Chris Beams * @since 3.0 - * @see org.springframework.context.annotation.support.ConfigurationClassPostProcessor; * @see Bean * @see Lazy + * @see Value + * @see org.springframework.context.annotation.support.ConfigurationClassPostProcessor; */ @Component @Target( { ElementType.TYPE }) @@ -64,6 +65,6 @@ public @interface Configuration { } -// TODO: test constructor autowiring
-// TODO: test private Configuration classes
-// TODO: test @Lazy @Configuration
+// TODO: test @Configuration constructor autowiring +// TODO: test @Lazy @Configuration + diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/package-info.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/package-info.java new file mode 100644 index 00000000000..a90a724769f --- /dev/null +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/package-info.java @@ -0,0 +1,10 @@ +/** + * Annotation support for context configuration, including classpath scanning for + * {@link org.springframework.beans.factory.annotation.Autowired} candidates + * and {@link Configuration} class processing. + * + * @author Juergen Hoeller + * @author Mark Fisher + * @author Chris Beams + */ +package org.springframework.context.annotation; \ No newline at end of file diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/package.html b/org.springframework.context/src/main/java/org/springframework/context/annotation/package.html deleted file mode 100644 index 4762b9c5807..00000000000 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/package.html +++ /dev/null @@ -1,8 +0,0 @@ - - - -Annotation support for context configuration, -including classpath scanning for autowire candidates. - - -