Skip to content

Commit

Permalink
Polish Javadoc
Browse files Browse the repository at this point in the history
Issue: SPR-14552
  • Loading branch information
snicoll committed Aug 6, 2016
1 parent e86529e commit 8aadb8d
Showing 1 changed file with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,22 @@
* {@code @Configuration} classes are candidates for component scanning (typically using
* Spring XML's {@code <context:component-scan/>} element) and therefore may also take
* advantage of {@link Autowired @Autowired}/{@link javax.inject.Inject @Inject}
* at the field and method level (but not at the constructor level).
* like any regular {@code @Component}. In particular, if a single constructor is present
* autowiring semantics will be applied transparently:
*
* <pre class="code">
* &#064;Configuration
* public class AppConfig {
* private final SomeBean someBean;
*
* public AppConfig(SomeBean someBean) {
* this.someBean = someBean;
* }
*
* // &#064;Bean definition using "SomeBean"
*
* }</pre>
*
* <p>{@code @Configuration} classes may not only be bootstrapped using
* component scanning, but may also themselves <em>configure</em> component scanning using
* the {@link ComponentScan @ComponentScan} annotation:
Expand All @@ -104,13 +119,13 @@
*
* Externalized values may be looked up by injecting the Spring
* {@link org.springframework.core.env.Environment} into a {@code @Configuration}
* class using the {@code @Autowired} or the {@code @Inject} annotation:
* class the usual (e.g. using the {@code @Autowired} annotation):
*
* <pre class="code">
* &#064;Configuration
* public class AppConfig {
*
* &#064Inject Environment env;
* &#064Autowired Environment env;
*
* &#064;Bean
* public MyBean myBean() {
Expand Down Expand Up @@ -175,7 +190,7 @@
* <p>{@code @Configuration} classes may be composed using the {@link Import @Import} annotation,
* not unlike the way that {@code <import>} works in Spring XML. Because
* {@code @Configuration} objects are managed as Spring beans within the container,
* imported configurations may be injected using {@code @Autowired} or {@code @Inject}:
* imported configurations may be injected the usual way (e.g. via constructor injection):
*
* <pre class="code">
* &#064;Configuration
Expand All @@ -191,7 +206,11 @@
* &#064;Import(DatabaseConfig.class)
* public class AppConfig {
*
* &#064Inject DatabaseConfig dataConfig;
* private final DatabaseConfig dataConfig;
*
* public AppConfig(DatabaseConfig dataConfig) {
* this.dataConfig = dataConfig;
* }
*
* &#064;Bean
* public MyBean myBean() {
Expand Down Expand Up @@ -240,8 +259,8 @@
* As mentioned above, {@code @Configuration} classes may be declared as regular Spring
* {@code <bean>} 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 using {@code @Autowired} or {@code @Inject}:
* the {@link ImportResource @ImportResource} annotation. Bean definitions imported from
* XML can be injected the usual way (e.g. using the {@code Inject} annotation):
*
* <pre class="code">
* &#064;Configuration
Expand Down Expand Up @@ -340,9 +359,7 @@
* <ul>
* <li>&#064;Configuration classes must be non-final
* <li>&#064;Configuration classes must be non-local (may not be declared within a method)
* <li>&#064;Configuration classes must have a default/no-arg constructor and may not use
* {@link Autowired @Autowired} constructor parameters. Any nested configuration classes
* must be {@code static}.
* <li>Any nested configuration classes must be {@code static}.
* </ul>
*
* @author Rod Johnson
Expand Down

0 comments on commit 8aadb8d

Please sign in to comment.