Skip to content

Commit 40cff5e

Browse files
committed
Polishing
1 parent ee35b5e commit 40cff5e

File tree

4 files changed

+42
-87
lines changed

4 files changed

+42
-87
lines changed

spring-test/src/main/java/org/springframework/test/context/ContextConfiguration.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@
9191

9292
/**
9393
* Alias for {@link #locations}.
94-
*
9594
* <p>This attribute may <strong>not</strong> be used in conjunction with
9695
* {@link #locations}, but it may be used instead of {@link #locations}.
97-
*
9896
* @since 3.0
9997
* @see #inheritLocations
10098
*/
@@ -104,7 +102,6 @@
104102
/**
105103
* The resource locations to use for loading an
106104
* {@link org.springframework.context.ApplicationContext ApplicationContext}.
107-
*
108105
* <p>Check out the Javadoc for
109106
* {@link org.springframework.test.context.support.AbstractContextLoader#modifyLocations
110107
* AbstractContextLoader.modifyLocations()} for details on how a location
@@ -113,7 +110,6 @@
113110
* {@link org.springframework.test.context.support.AbstractContextLoader#generateDefaultLocations
114111
* AbstractContextLoader.generateDefaultLocations()} for details on the
115112
* default locations that are going to be used if none are specified.
116-
*
117113
* <p>Note that the aforementioned default rules only apply for a standard
118114
* {@link org.springframework.test.context.support.AbstractContextLoader
119115
* AbstractContextLoader} subclass such as
@@ -122,10 +118,8 @@
122118
* which are the effective default implementations used at runtime if
123119
* {@code locations} are configured. See the documentation for {@link #loader}
124120
* for further details regarding default loaders.
125-
*
126121
* <p>This attribute may <strong>not</strong> be used in conjunction with
127122
* {@link #value}, but it may be used instead of {@link #value}.
128-
*
129123
* @since 2.5
130124
* @see #inheritLocations
131125
*/
@@ -135,14 +129,12 @@
135129
/**
136130
* The <em>annotated classes</em> to use for loading an
137131
* {@link org.springframework.context.ApplicationContext ApplicationContext}.
138-
*
139-
* <p>Check out the Javadoc for
132+
* <p>Check out the javadoc for
140133
* {@link org.springframework.test.context.support.AnnotationConfigContextLoader#detectDefaultConfigurationClasses
141134
* AnnotationConfigContextLoader.detectDefaultConfigurationClasses()} for details
142135
* on how default configuration classes will be detected if no
143136
* <em>annotated classes</em> are specified. See the documentation for
144137
* {@link #loader} for further details regarding default loaders.
145-
*
146138
* @since 3.1
147139
* @see org.springframework.context.annotation.Configuration
148140
* @see org.springframework.test.context.support.AnnotationConfigContextLoader
@@ -153,16 +145,13 @@
153145
/**
154146
* The application context <em>initializer classes</em> to use for initializing
155147
* a {@link ConfigurableApplicationContext}.
156-
*
157148
* <p>The concrete {@code ConfigurableApplicationContext} type supported by each
158149
* declared initializer must be compatible with the type of {@code ApplicationContext}
159150
* created by the {@link SmartContextLoader} in use.
160-
*
161151
* <p>{@code SmartContextLoader} implementations typically detect whether
162152
* Spring's {@link org.springframework.core.Ordered Ordered} interface has been
163153
* implemented or if the @{@link org.springframework.core.annotation.Order Order}
164154
* annotation is present and sort instances accordingly prior to invoking them.
165-
*
166155
* @since 3.2
167156
* @see org.springframework.context.ApplicationContextInitializer
168157
* @see org.springframework.context.ConfigurableApplicationContext
@@ -174,20 +163,17 @@
174163
/**
175164
* Whether or not {@link #locations resource locations} or <em>annotated
176165
* classes</em> from test superclasses should be <em>inherited</em>.
177-
*
178166
* <p>The default value is {@code true}. This means that an annotated
179167
* class will <em>inherit</em> the resource locations or annotated classes
180168
* defined by test superclasses. Specifically, the resource locations or
181169
* annotated classes for a given test class will be appended to the list of
182170
* resource locations or annotated classes defined by test superclasses.
183171
* Thus, subclasses have the option of <em>extending</em> the list of resource
184172
* locations or annotated classes.
185-
*
186173
* <p>If {@code inheritLocations} is set to {@code false}, the
187174
* resource locations or annotated classes for the annotated class
188175
* will <em>shadow</em> and effectively replace any resource locations
189176
* or annotated classes defined by superclasses.
190-
*
191177
* <p>In the following example that uses path-based resource locations, the
192178
* {@link org.springframework.context.ApplicationContext ApplicationContext}
193179
* for {@code ExtendedTest} will be loaded from
@@ -206,7 +192,6 @@
206192
* // ...
207193
* }
208194
* </pre>
209-
*
210195
* <p>Similarly, in the following example that uses annotated
211196
* classes, the
212197
* {@link org.springframework.context.ApplicationContext ApplicationContext}
@@ -233,18 +218,15 @@
233218
/**
234219
* Whether or not {@linkplain #initializers context initializers} from test
235220
* superclasses should be <em>inherited</em>.
236-
*
237221
* <p>The default value is {@code true}. This means that an annotated
238222
* class will <em>inherit</em> the application context initializers defined
239223
* by test superclasses. Specifically, the initializers for a given test
240224
* class will be added to the set of initializers defined by test
241225
* superclasses. Thus, subclasses have the option of <em>extending</em> the
242226
* set of initializers.
243-
*
244227
* <p>If {@code inheritInitializers} is set to {@code false}, the
245228
* initializers for the annotated class will <em>shadow</em> and effectively
246229
* replace any initializers defined by superclasses.
247-
*
248230
* <p>In the following example, the
249231
* {@link org.springframework.context.ApplicationContext ApplicationContext}
250232
* for {@code ExtendedTest} will be initialized using
@@ -272,12 +254,10 @@
272254
* The type of {@link SmartContextLoader} (or {@link ContextLoader}) to use
273255
* for loading an {@link org.springframework.context.ApplicationContext
274256
* ApplicationContext}.
275-
*
276257
* <p>If not specified, the loader will be inherited from the first superclass
277258
* that is annotated with {@code @ContextConfiguration} and specifies an
278259
* explicit loader. If no class in the hierarchy specifies an explicit
279260
* loader, a default loader will be used instead.
280-
*
281261
* <p>The default concrete implementation chosen at runtime will be either
282262
* {@link org.springframework.test.context.support.DelegatingSmartContextLoader
283263
* DelegatingSmartContextLoader} or
@@ -293,23 +273,19 @@
293273
* {@link org.springframework.test.context.web.GenericXmlWebContextLoader GenericXmlWebContextLoader},
294274
* {@link org.springframework.test.context.web.GenericGroovyXmlWebContextLoader GenericGroovyXmlWebContextLoader}, and
295275
* {@link org.springframework.test.context.web.AnnotationConfigWebContextLoader AnnotationConfigWebContextLoader}.
296-
*
297276
* @since 2.5
298277
*/
299278
Class<? extends ContextLoader> loader() default ContextLoader.class;
300279

301280
/**
302281
* The name of the context hierarchy level represented by this configuration.
303-
*
304282
* <p>If not specified the name will be inferred based on the numerical level
305283
* within all declared contexts within the hierarchy.
306-
*
307284
* <p>This attribute is only applicable when used within a test class hierarchy
308285
* that is configured using {@code @ContextHierarchy}, in which case the name
309286
* can be used for <em>merging</em> or <em>overriding</em> this configuration
310287
* with configuration of the same name in hierarchy levels defined in superclasses.
311288
* See the Javadoc for {@link ContextHierarchy @ContextHierarchy} for details.
312-
*
313289
* @since 3.2.2
314290
*/
315291
String name() default "";

spring-test/src/main/java/org/springframework/test/context/ContextHierarchy.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -148,7 +148,6 @@
148148
/**
149149
* A list of {@link ContextConfiguration @ContextConfiguration} instances,
150150
* each of which defines a level in the context hierarchy.
151-
*
152151
* <p>If you need to merge or override the configuration for a given level
153152
* of the context hierarchy within a test class hierarchy, you must explicitly
154153
* name that level by supplying the same value to the {@link ContextConfiguration#name

spring-test/src/main/java/org/springframework/test/context/ContextLoader.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,8 +33,7 @@
3333
* The results of {@link #processLocations(Class, String...) processLocations()}
3434
* should then be supplied to {@link #loadContext(String...) loadContext()}.
3535
*
36-
* <p>Concrete implementations must provide a {@code public} no-args
37-
* constructor.
36+
* <p>Concrete implementations must provide a {@code public} no-args constructor.
3837
*
3938
* <p>Spring provides the following out-of-the-box implementations:
4039
* <ul>
@@ -52,10 +51,8 @@ public interface ContextLoader {
5251

5352
/**
5453
* Processes application context resource locations for a specified class.
55-
*
5654
* <p>Concrete implementations may choose to modify the supplied locations,
5755
* generate new locations, or simply return the supplied locations unchanged.
58-
*
5956
* @param clazz the class with which the locations are associated: used to
6057
* determine how to process the supplied locations
6158
* @param locations the unmodified locations to use for loading the
@@ -68,24 +65,20 @@ public interface ContextLoader {
6865
* Loads a new {@link ApplicationContext context} based on the supplied
6966
* {@code locations}, configures the context, and finally returns
7067
* the context in fully <em>refreshed</em> state.
71-
*
7268
* <p>Configuration locations are generally considered to be classpath
7369
* resources by default.
74-
*
7570
* <p>Concrete implementations should register annotation configuration
7671
* processors with bean factories of {@link ApplicationContext application
7772
* contexts} loaded by this ContextLoader. Beans will therefore automatically
7873
* be candidates for annotation-based dependency injection using
7974
* {@link org.springframework.beans.factory.annotation.Autowired @Autowired},
8075
* {@link javax.annotation.Resource @Resource}, and
8176
* {@link javax.inject.Inject @Inject}.
82-
*
8377
* <p>Any ApplicationContext loaded by a ContextLoader <strong>must</strong>
8478
* register a JVM shutdown hook for itself. Unless the context gets closed
8579
* early, all context instances will be automatically closed on JVM
8680
* shutdown. This allows for freeing external resources held by beans within
8781
* the context, e.g. temporary files.
88-
*
8982
* @param locations the resource locations to use to load the application context
9083
* @return a new application context
9184
* @throws Exception if context loading failed

0 commit comments

Comments
 (0)