From 52c91910b28f3046b3fd2f68040fdf9bc95bc2dc Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 26 Aug 2018 15:03:05 +0200 Subject: [PATCH] Polish JavaDoc for @Configuration --- .../context/annotation/Configuration.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java index 08fd5d0c2a0..ef8c25f645b 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -86,11 +86,12 @@ import org.springframework.stereotype.Component; * Spring XML's {@code } element) and therefore may also take * advantage of {@link Autowired @Autowired}/{@link javax.inject.Inject @Inject} * like any regular {@code @Component}. In particular, if a single constructor is present - * autowiring semantics will be applied transparently: + * autowiring semantics will be applied transparently for that constructor: * *
  * @Configuration
  * public class AppConfig {
+ *
  *     private final SomeBean someBean;
  *
  *     public AppConfig(SomeBean someBean) {
@@ -120,7 +121,7 @@ import org.springframework.stereotype.Component;
  *
  * Externalized values may be looked up by injecting the Spring
  * {@link org.springframework.core.env.Environment} into a {@code @Configuration}
- * class as usual (e.g. using the {@code @Autowired} annotation):
+ * class — for example, using the {@code @Autowired} annotation:
  *
  * 
  * @Configuration
@@ -180,8 +181,8 @@ import org.springframework.stereotype.Component;
  * PropertySourcesPlaceholderConfigurer}, usually enabled via XML with
  * {@code }.  See the section below on composing
  * {@code @Configuration} classes with Spring XML using {@code @ImportResource},
- * see {@link Value @Value} Javadoc, and see {@link Bean @Bean} Javadoc for details on working with
- * {@code BeanFactoryPostProcessor} types such as
+ * see {@link Value @Value} Javadoc, and see {@link Bean @Bean} Javadoc for details
+ * on working with {@code BeanFactoryPostProcessor} types such as
  * {@code PropertySourcesPlaceholderConfigurer}.
  *
  * 

Composing {@code @Configuration} classes

@@ -189,9 +190,9 @@ import org.springframework.stereotype.Component; *

With the {@code @Import} annotation

* *

{@code @Configuration} classes may be composed using the {@link Import @Import} annotation, - * not unlike the way that {@code } works in Spring XML. Because + * similar to the way that {@code } works in Spring XML. Because * {@code @Configuration} objects are managed as Spring beans within the container, - * imported configurations may be injected the usual way (e.g. via constructor injection): + * imported configurations may be injected — for example, via constructor injection: * *

  * @Configuration
@@ -277,7 +278,7 @@ import org.springframework.stereotype.Component;
  * {@code } definitions within Spring XML files. It is also possible to
  * import Spring XML configuration files into {@code @Configuration} classes using
  * the {@link ImportResource @ImportResource} annotation. Bean definitions imported from
- * XML can be injected the usual way (e.g. using the {@code Inject} annotation):
+ * XML can be injected — for example, using the {@code @Inject} annotation:
  *
  * 
  * @Configuration
@@ -338,12 +339,12 @@ import org.springframework.stereotype.Component;
  * 

Testing support for {@code @Configuration} classes

* * The Spring TestContext framework available in the {@code spring-test} module - * provides the {@code @ContextConfiguration} annotation, which as of Spring 3.1 can - * accept an array of {@code @Configuration} {@code Class} objects: + * provides the {@code @ContextConfiguration} annotation which can accept an array of + * {@code @Configuration} {@code Class} objects: * *
- * @RunWith(SpringJUnit4ClassRunner.class)
- * @ContextConfiguration(classes={AppConfig.class, DatabaseConfig.class})
+ * @RunWith(SpringRunner.class)
+ * @ContextConfiguration(classes = {AppConfig.class, DatabaseConfig.class})
  * public class MyTests {
  *
  *     @Autowired MyBean myBean;
@@ -356,7 +357,9 @@ import org.springframework.stereotype.Component;
  *     }
  * }
* - * See TestContext framework reference documentation for details. + *

See the + * TestContext framework + * reference documentation for details. * *

Enabling built-in Spring features using {@code @Enable} annotations

*