Skip to content

Commit f54aac1

Browse files
committed
Polishing
1 parent c2fed6e commit f54aac1

File tree

4 files changed

+43
-87
lines changed

4 files changed

+43
-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
@@ -90,10 +90,8 @@
9090

9191
/**
9292
* Alias for {@link #locations}.
93-
*
9493
* <p>This attribute may <strong>not</strong> be used in conjunction with
9594
* {@link #locations}, but it may be used instead of {@link #locations}.
96-
*
9795
* @since 3.0
9896
* @see #inheritLocations
9997
*/
@@ -102,7 +100,6 @@
102100
/**
103101
* The resource locations to use for loading an
104102
* {@link org.springframework.context.ApplicationContext ApplicationContext}.
105-
*
106103
* <p>Check out the Javadoc for
107104
* {@link org.springframework.test.context.support.AbstractContextLoader#modifyLocations
108105
* AbstractContextLoader.modifyLocations()} for details on how a location
@@ -111,7 +108,6 @@
111108
* {@link org.springframework.test.context.support.AbstractContextLoader#generateDefaultLocations
112109
* AbstractContextLoader.generateDefaultLocations()} for details on the
113110
* default locations that are going to be used if none are specified.
114-
*
115111
* <p>Note that the aforementioned default rules only apply for a standard
116112
* {@link org.springframework.test.context.support.AbstractContextLoader
117113
* AbstractContextLoader} subclass such as
@@ -120,10 +116,8 @@
120116
* which are the effective default implementations used at runtime if
121117
* {@code locations} are configured. See the documentation for {@link #loader}
122118
* for further details regarding default loaders.
123-
*
124119
* <p>This attribute may <strong>not</strong> be used in conjunction with
125120
* {@link #value}, but it may be used instead of {@link #value}.
126-
*
127121
* @since 2.5
128122
* @see #inheritLocations
129123
*/
@@ -132,14 +126,12 @@
132126
/**
133127
* The <em>annotated classes</em> to use for loading an
134128
* {@link org.springframework.context.ApplicationContext ApplicationContext}.
135-
*
136-
* <p>Check out the Javadoc for
129+
* <p>Check out the javadoc for
137130
* {@link org.springframework.test.context.support.AnnotationConfigContextLoader#detectDefaultConfigurationClasses
138131
* AnnotationConfigContextLoader.detectDefaultConfigurationClasses()} for details
139132
* on how default configuration classes will be detected if no
140133
* <em>annotated classes</em> are specified. See the documentation for
141134
* {@link #loader} for further details regarding default loaders.
142-
*
143135
* @since 3.1
144136
* @see org.springframework.context.annotation.Configuration
145137
* @see org.springframework.test.context.support.AnnotationConfigContextLoader
@@ -150,16 +142,13 @@
150142
/**
151143
* The application context <em>initializer classes</em> to use for initializing
152144
* a {@link ConfigurableApplicationContext}.
153-
*
154145
* <p>The concrete {@code ConfigurableApplicationContext} type supported by each
155146
* declared initializer must be compatible with the type of {@code ApplicationContext}
156147
* created by the {@link SmartContextLoader} in use.
157-
*
158148
* <p>{@code SmartContextLoader} implementations typically detect whether
159149
* Spring's {@link org.springframework.core.Ordered Ordered} interface has been
160150
* implemented or if the @{@link org.springframework.core.annotation.Order Order}
161151
* annotation is present and sort instances accordingly prior to invoking them.
162-
*
163152
* @since 3.2
164153
* @see org.springframework.context.ApplicationContextInitializer
165154
* @see org.springframework.context.ConfigurableApplicationContext
@@ -171,20 +160,17 @@
171160
/**
172161
* Whether or not {@link #locations resource locations} or <em>annotated
173162
* classes</em> from test superclasses should be <em>inherited</em>.
174-
*
175163
* <p>The default value is {@code true}. This means that an annotated
176164
* class will <em>inherit</em> the resource locations or annotated classes
177165
* defined by test superclasses. Specifically, the resource locations or
178166
* annotated classes for a given test class will be appended to the list of
179167
* resource locations or annotated classes defined by test superclasses.
180168
* Thus, subclasses have the option of <em>extending</em> the list of resource
181169
* locations or annotated classes.
182-
*
183170
* <p>If {@code inheritLocations} is set to {@code false}, the
184171
* resource locations or annotated classes for the annotated class
185172
* will <em>shadow</em> and effectively replace any resource locations
186173
* or annotated classes defined by superclasses.
187-
*
188174
* <p>In the following example that uses path-based resource locations, the
189175
* {@link org.springframework.context.ApplicationContext ApplicationContext}
190176
* for {@code ExtendedTest} will be loaded from
@@ -203,7 +189,6 @@
203189
* // ...
204190
* }
205191
* </pre>
206-
*
207192
* <p>Similarly, in the following example that uses annotated
208193
* classes, the
209194
* {@link org.springframework.context.ApplicationContext ApplicationContext}
@@ -230,18 +215,15 @@
230215
/**
231216
* Whether or not {@linkplain #initializers context initializers} from test
232217
* superclasses should be <em>inherited</em>.
233-
*
234218
* <p>The default value is {@code true}. This means that an annotated
235219
* class will <em>inherit</em> the application context initializers defined
236220
* by test superclasses. Specifically, the initializers for a given test
237221
* class will be added to the set of initializers defined by test
238222
* superclasses. Thus, subclasses have the option of <em>extending</em> the
239223
* set of initializers.
240-
*
241224
* <p>If {@code inheritInitializers} is set to {@code false}, the
242225
* initializers for the annotated class will <em>shadow</em> and effectively
243226
* replace any initializers defined by superclasses.
244-
*
245227
* <p>In the following example, the
246228
* {@link org.springframework.context.ApplicationContext ApplicationContext}
247229
* for {@code ExtendedTest} will be initialized using
@@ -269,12 +251,10 @@
269251
* The type of {@link SmartContextLoader} (or {@link ContextLoader}) to use
270252
* for loading an {@link org.springframework.context.ApplicationContext
271253
* ApplicationContext}.
272-
*
273254
* <p>If not specified, the loader will be inherited from the first superclass
274255
* that is annotated with {@code @ContextConfiguration} and specifies an
275256
* explicit loader. If no class in the hierarchy specifies an explicit
276257
* loader, a default loader will be used instead.
277-
*
278258
* <p>The default concrete implementation chosen at runtime will be either
279259
* {@link org.springframework.test.context.support.DelegatingSmartContextLoader
280260
* DelegatingSmartContextLoader} or
@@ -290,23 +270,19 @@
290270
* {@link org.springframework.test.context.web.GenericXmlWebContextLoader GenericXmlWebContextLoader},
291271
* {@link org.springframework.test.context.web.GenericGroovyXmlWebContextLoader GenericGroovyXmlWebContextLoader}, and
292272
* {@link org.springframework.test.context.web.AnnotationConfigWebContextLoader AnnotationConfigWebContextLoader}.
293-
*
294273
* @since 2.5
295274
*/
296275
Class<? extends ContextLoader> loader() default ContextLoader.class;
297276

298277
/**
299278
* The name of the context hierarchy level represented by this configuration.
300-
*
301279
* <p>If not specified the name will be inferred based on the numerical level
302280
* within all declared contexts within the hierarchy.
303-
*
304281
* <p>This attribute is only applicable when used within a test class hierarchy
305282
* that is configured using {@code @ContextHierarchy}, in which case the name
306283
* can be used for <em>merging</em> or <em>overriding</em> this configuration
307284
* with configuration of the same name in hierarchy levels defined in superclasses.
308285
* See the Javadoc for {@link ContextHierarchy @ContextHierarchy} for details.
309-
*
310286
* @since 3.2.2
311287
*/
312288
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)