Skip to content

Commit 3920c5a

Browse files
committed
Polish @ComponentScan/@Configuration/@lazy Javadoc
1 parent 1cea52b commit 3920c5a

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,25 @@
2626
import org.springframework.core.type.filter.TypeFilter;
2727

2828
/**
29-
* Configures component scanning directives for use with {@link Configuration @Configuration}
30-
* classes. Provides support parallel with Spring XML's {@code <context:component-scan>}
31-
* element.
29+
* Configures component scanning directives for use with @{@link Configuration} classes.
30+
* Provides support parallel with Spring XML's {@code <context:component-scan>} element.
3231
*
33-
* <p>One of {@link #basePackageClasses()}, {@link #basePackages()} or its alias {@link #value()}
34-
* must be specified.
32+
* <p>One of {@link #basePackageClasses()}, {@link #basePackages()} or its alias
33+
* {@link #value()} must be specified.
3534
*
36-
* <p>Note that the {@code <context:component-scan>} element has an {@code annotation-config}
37-
* attribute, however this annotation does not. This is because in almost all cases when
38-
* using {@code @ComponentScan}, default annotation config processing (e.g.
39-
* processing {@code @Autowired} and friends) is assumed. Furthermore, when using
40-
* {@link AnnotationConfigApplicationContext}, annotation config processors are always
41-
* registered, meaning that any attempt to disable them at the {@code @ComponentScan} level
42-
* would be ignored.
35+
* <p>Note that the {@code <context:component-scan>} element has an
36+
* {@code annotation-config} attribute, however this annotation does not. This is because
37+
* in almost all cases when using {@code @ComponentScan}, default annotation config
38+
* processing (e.g. processing {@code @Autowired} and friends) is assumed. Furthermore,
39+
* when using {@link AnnotationConfigApplicationContext}, annotation config processors are
40+
* always registered, meaning that any attempt to disable them at the
41+
* {@code @ComponentScan} level would be ignored.
42+
*
43+
* <p>See @{@link Configuration} Javadoc for usage examples.
4344
*
4445
* @author Chris Beams
4546
* @since 3.1
47+
* @see Configuration
4648
*/
4749
@Retention(RetentionPolicy.RUNTIME)
4850
@Target(ElementType.TYPE)

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@
211211
* }
212212
* }</pre>
213213
*
214-
* See @{@link Profile} and {@link org.springframework.core.env.Environment} Javadoc for
215-
* further details.
214+
* See @{@link Profile} and {@link org.springframework.core.env.Environment Environment}
215+
* Javadoc for further details.
216216
*
217217
* <h3>With Spring XML using the {@code @ImportResource} annotation</h3>
218218
* As mentioned above, {@code @Configuration} classes may be declared as regular Spring
@@ -273,10 +273,8 @@
273273
*
274274
* <h2>Testing support for {@code @Configuration} classes</h2>
275275
* The Spring <em>TestContext framework</em> available in the {@code spring-test} module
276-
* provides the
277-
* {@link org.springframework.test.context.ContextConfiguration @ContextConfiguration}
278-
* annotation, which as of Spring 3.1 can accept an array of {@code @Configuration}
279-
* {@code Class} objects:
276+
* provides the {@code @ContextConfiguration} annotation, which as of Spring 3.1 can
277+
* accept an array of {@code @Configuration} {@code Class} objects:
280278
* <pre class="code">
281279
* &#064;RunWith(SpringJUnit4ClassRunner.class)
282280
* &#064;ContextConfiguration(classes={AppConfig.class, DatabaseConfig.class})

org.springframework.context/src/main/java/org/springframework/context/annotation/Lazy.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,22 @@
2626
/**
2727
* Indicates whether a bean is to be lazily initialized.
2828
*
29-
* <p>May be used on any class directly or indirectly annotated with
30-
* {@link org.springframework.stereotype.Component} or on methods annotated with
31-
* {@link Bean}.
29+
* <p>May be used on any class directly or indirectly annotated with {@link
30+
* org.springframework.stereotype.Component @Component} or on methods annotated with
31+
* {@link Bean @Bean}.
3232
*
33-
* <p>If this annotation is not present on a Component or Bean definition, eager
34-
* initialization will occur. If present and set to {@code true}, the
35-
* Bean/Component will not be initialized until referenced by another bean or
36-
* explicitly retrieved from the enclosing
37-
* {@link org.springframework.beans.factory.BeanFactory}. If present and set to
38-
* {@code false}, the bean will be instantiated on startup by bean factories
39-
* that perform eager initialization of singletons.
33+
* <p>If this annotation is not present on a {@code @Component} or {@code @Bean} definition,
34+
* eager initialization will occur. If present and set to {@code true}, the {@code @Bean} or
35+
* {@code @Component} will not be initialized until referenced by another bean or explicitly
36+
* retrieved from the enclosing {@link org.springframework.beans.factory.BeanFactory
37+
* BeanFactory}. If present and set to {@code false}, the bean will be instantiated on
38+
* startup by bean factories that perform eager initialization of singletons.
4039
*
4140
* <p>If Lazy is present on a {@link Configuration @Configuration} class, this
42-
* indicates that all {@link Bean @Bean} methods within that {@code @Configuration}
43-
* should be lazily initialized. If Lazy is present and false on a Bean method
44-
* within a Lazy-annotated Configuration class, this indicates overriding the
45-
* 'default lazy' behavior and that the bean should be eagerly initialized.
41+
* indicates that all {@code @Bean} methods within that {@code @Configuration}
42+
* should be lazily initialized. If {@code @Lazy} is present and false on a {@code @Bean}
43+
* method within a {@code @Lazy}-annotated {@code @Configuration} class, this indicates
44+
* overriding the 'default lazy' behavior and that the bean should be eagerly initialized.
4645
*
4746
* @author Chris Beams
4847
* @since 3.0

0 commit comments

Comments
 (0)