Skip to content

Commit 4883b8a

Browse files
committed
Polish JavaDoc for @configuration
1 parent 08ba53d commit 4883b8a

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

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

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
*
4747
* <h3>Via {@code AnnotationConfigApplicationContext}</h3>
4848
*
49-
* {@code @Configuration} classes are typically bootstrapped using either
49+
* <p>{@code @Configuration} classes are typically bootstrapped using either
5050
* {@link AnnotationConfigApplicationContext} or its web-capable variant,
5151
* {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext
5252
* AnnotationConfigWebApplicationContext}. A simple example with the former follows:
@@ -59,23 +59,25 @@
5959
* // use myBean ...
6060
* </pre>
6161
*
62-
* See {@link AnnotationConfigApplicationContext} Javadoc for further details and see
62+
* <p>See the {@link AnnotationConfigApplicationContext} javadocs for further details, and see
6363
* {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext
64-
* AnnotationConfigWebApplicationContext} for {@code web.xml} configuration instructions.
64+
* AnnotationConfigWebApplicationContext} for web configuration instructions in a
65+
* {@code Servlet} container.
6566
*
6667
* <h3>Via Spring {@code <beans>} XML</h3>
6768
*
6869
* <p>As an alternative to registering {@code @Configuration} classes directly against an
6970
* {@code AnnotationConfigApplicationContext}, {@code @Configuration} classes may be
7071
* declared as normal {@code <bean>} definitions within Spring XML files:
72+
*
7173
* <pre class="code">
7274
* &lt;beans&gt;
7375
* &lt;context:annotation-config/&gt;
7476
* &lt;bean class="com.acme.AppConfig"/&gt;
7577
* &lt;/beans&gt;
7678
* </pre>
7779
*
78-
* In the example above, {@code <context:annotation-config/>} is required in order to
80+
* <p>In the example above, {@code <context:annotation-config/>} is required in order to
7981
* enable {@link ConfigurationClassPostProcessor} and other annotation-related
8082
* post processors that facilitate handling {@code @Configuration} classes.
8183
*
@@ -113,13 +115,13 @@
113115
* // various &#064;Bean definitions ...
114116
* }</pre>
115117
*
116-
* See the {@link ComponentScan @ComponentScan} javadoc for details.
118+
* <p>See the {@link ComponentScan @ComponentScan} javadocs for details.
117119
*
118120
* <h2>Working with externalized values</h2>
119121
*
120122
* <h3>Using the {@code Environment} API</h3>
121123
*
122-
* Externalized values may be looked up by injecting the Spring
124+
* <p>Externalized values may be looked up by injecting the Spring
123125
* {@link org.springframework.core.env.Environment} into a {@code @Configuration}
124126
* class &mdash; for example, using the {@code @Autowired} annotation:
125127
*
@@ -137,7 +139,7 @@
137139
* }
138140
* }</pre>
139141
*
140-
* Properties resolved through the {@code Environment} reside in one or more "property
142+
* <p>Properties resolved through the {@code Environment} reside in one or more "property
141143
* source" objects, and {@code @Configuration} classes may contribute property sources to
142144
* the {@code Environment} object using the {@link PropertySource @PropertySource}
143145
* annotation:
@@ -155,13 +157,13 @@
155157
* }
156158
* }</pre>
157159
*
158-
* See {@link org.springframework.core.env.Environment Environment}
159-
* and {@link PropertySource @PropertySource} Javadoc for further details.
160+
* <p>See the {@link org.springframework.core.env.Environment Environment}
161+
* and {@link PropertySource @PropertySource} javadocs for further details.
160162
*
161163
* <h3>Using the {@code @Value} annotation</h3>
162164
*
163-
* Externalized values may be 'wired into' {@code @Configuration} classes using
164-
* the {@link Value @Value} annotation:
165+
* <p>Externalized values may be injected {@code @Configuration} classes using the
166+
* {@link Value @Value} annotation:
165167
*
166168
* <pre class="code">
167169
* &#064;Configuration
@@ -176,13 +178,13 @@
176178
* }
177179
* }</pre>
178180
*
179-
* This approach is most useful when using Spring's
181+
* <p>This approach is most useful when using Spring's
180182
* {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
181183
* PropertySourcesPlaceholderConfigurer}, usually enabled via XML with
182184
* {@code <context:property-placeholder/>}. See the section below on composing
183185
* {@code @Configuration} classes with Spring XML using {@code @ImportResource},
184-
* see {@link Value @Value} Javadoc, and see {@link Bean @Bean} Javadoc for details
185-
* on working with {@code BeanFactoryPostProcessor} types such as
186+
* see the {@link Value @Value} javadocs, and see the {@link Bean @Bean} javadocs for
187+
* details on working with {@code BeanFactoryPostProcessor} types such as
186188
* {@code PropertySourcesPlaceholderConfigurer}.
187189
*
188190
* <h2>Composing {@code @Configuration} classes</h2>
@@ -221,15 +223,15 @@
221223
* }
222224
* }</pre>
223225
*
224-
* Now both {@code AppConfig} and the imported {@code DatabaseConfig} can be bootstrapped
226+
* <p>Now both {@code AppConfig} and the imported {@code DatabaseConfig} can be bootstrapped
225227
* by registering only {@code AppConfig} against the Spring context:
226228
*
227229
* <pre class="code">
228230
* new AnnotationConfigApplicationContext(AppConfig.class);</pre>
229231
*
230232
* <h3>With the {@code @Profile} annotation</h3>
231233
*
232-
* {@code @Configuration} classes may be marked with the {@link Profile @Profile} annotation to
234+
* <p>{@code @Configuration} classes may be marked with the {@link Profile @Profile} annotation to
233235
* indicate they should be processed only if a given profile or profiles are <em>active</em>:
234236
*
235237
* <pre class="code">
@@ -253,8 +255,8 @@
253255
* }
254256
* }</pre>
255257
*
256-
* Alternatively, you may also declare profile conditions at the {@code @Bean} method level,
257-
* e.g. for alternative bean variants within the same configuration class:
258+
* <p>Alternatively, you may also declare profile conditions at the {@code @Bean} method level
259+
* &mdash; for example, for alternative bean variants within the same configuration class:
258260
*
259261
* <pre class="code">
260262
* &#064;Configuration
@@ -269,12 +271,12 @@
269271
* public DataSource productionDatabase() { ... }
270272
* }</pre>
271273
*
272-
* See the {@link Profile @Profile} and {@link org.springframework.core.env.Environment}
274+
* <p>See the {@link Profile @Profile} and {@link org.springframework.core.env.Environment}
273275
* javadocs for further details.
274276
*
275277
* <h3>With Spring XML using the {@code @ImportResource} annotation</h3>
276278
*
277-
* As mentioned above, {@code @Configuration} classes may be declared as regular Spring
279+
* <p>As mentioned above, {@code @Configuration} classes may be declared as regular Spring
278280
* {@code <bean>} definitions within Spring XML files. It is also possible to
279281
* import Spring XML configuration files into {@code @Configuration} classes using
280282
* the {@link ImportResource @ImportResource} annotation. Bean definitions imported from
@@ -296,7 +298,7 @@
296298
*
297299
* <h3>With nested {@code @Configuration} classes</h3>
298300
*
299-
* {@code @Configuration} classes may be nested within one another as follows:
301+
* <p>{@code @Configuration} classes may be nested within one another as follows:
300302
*
301303
* <pre class="code">
302304
* &#064;Configuration
@@ -318,11 +320,11 @@
318320
* }
319321
* }</pre>
320322
*
321-
* When bootstrapping such an arrangement, only {@code AppConfig} need be registered
323+
* <p>When bootstrapping such an arrangement, only {@code AppConfig} need be registered
322324
* against the application context. By virtue of being a nested {@code @Configuration}
323325
* class, {@code DatabaseConfig} <em>will be registered automatically</em>. This avoids
324326
* the need to use an {@code @Import} annotation when the relationship between
325-
* {@code AppConfig} {@code DatabaseConfig} is already implicitly clear.
327+
* {@code AppConfig} and {@code DatabaseConfig} is already implicitly clear.
326328
*
327329
* <p>Note also that nested {@code @Configuration} classes can be used to good effect
328330
* with the {@code @Profile} annotation to provide two options of the same bean to the
@@ -338,7 +340,7 @@
338340
*
339341
* <h2>Testing support for {@code @Configuration} classes</h2>
340342
*
341-
* The Spring <em>TestContext framework</em> available in the {@code spring-test} module
343+
* <p>The Spring <em>TestContext framework</em> available in the {@code spring-test} module
342344
* provides the {@code @ContextConfiguration} annotation which can accept an array of
343345
* {@code @Configuration} {@code Class} objects:
344346
*
@@ -363,10 +365,10 @@
363365
*
364366
* <h2>Enabling built-in Spring features using {@code @Enable} annotations</h2>
365367
*
366-
* Spring features such as asynchronous method execution, scheduled task execution,
368+
* <p>Spring features such as asynchronous method execution, scheduled task execution,
367369
* annotation driven transaction management, and even Spring MVC can be enabled and
368-
* configured from {@code @Configuration}
369-
* classes using their respective "{@code @Enable}" annotations. See
370+
* configured from {@code @Configuration} classes using their respective "{@code @Enable}"
371+
* annotations. See
370372
* {@link org.springframework.scheduling.annotation.EnableAsync @EnableAsync},
371373
* {@link org.springframework.scheduling.annotation.EnableScheduling @EnableScheduling},
372374
* {@link org.springframework.transaction.annotation.EnableTransactionManagement @EnableTransactionManagement},
@@ -409,14 +411,15 @@
409411
public @interface Configuration {
410412

411413
/**
412-
* Explicitly specify the name of the Spring bean definition associated
413-
* with this Configuration class. If left unspecified (the common case),
414-
* a bean name will be automatically generated.
415-
* <p>The custom name applies only if the Configuration class is picked up via
416-
* component scanning or supplied directly to a {@link AnnotationConfigApplicationContext}.
417-
* If the Configuration class is registered as a traditional XML bean definition,
418-
* the name/id of the bean element will take precedence.
419-
* @return the suggested component name, if any (or empty String otherwise)
414+
* Explicitly specify the name of the Spring bean definition associated with the
415+
* {@code @Configuration} class. If left unspecified (the common case), a bean
416+
* name will be automatically generated.
417+
* <p>The custom name applies only if the {@code @Configuration} class is picked
418+
* up via component scanning or supplied directly to an
419+
* {@link AnnotationConfigApplicationContext}. If the {@code @Configuration} class
420+
* is registered as a traditional XML bean definition, the name/id of the bean
421+
* element will take precedence.
422+
* @return the explicit component name, if any (or empty String otherwise)
420423
* @see org.springframework.beans.factory.support.DefaultBeanNameGenerator
421424
*/
422425
@AliasFor(annotation = Component.class)

0 commit comments

Comments
 (0)