Polishing
This commit is contained in:
parent
b3e3c5312f
commit
cc917de24d
|
|
@ -367,14 +367,15 @@ public class AnnotationConfigUtils {
|
|||
|
||||
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
|
||||
Class<?> containerClass, Class<?> annotationClass) {
|
||||
|
||||
return attributesForRepeatable(metadata, containerClass.getName(), annotationClass.getName());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
|
||||
String containerClassName, String annotationClassName) {
|
||||
Set<AnnotationAttributes> result = new LinkedHashSet<AnnotationAttributes>();
|
||||
|
||||
Set<AnnotationAttributes> result = new LinkedHashSet<AnnotationAttributes>();
|
||||
addAttributesIfNotNull(result, metadata.getAnnotationAttributes(annotationClassName, false));
|
||||
|
||||
Map<String, Object> container = metadata.getAnnotationAttributes(containerClassName, false);
|
||||
|
|
@ -386,8 +387,7 @@ public class AnnotationConfigUtils {
|
|||
return Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
private static void addAttributesIfNotNull(Set<AnnotationAttributes> result,
|
||||
Map<String, Object> attributes) {
|
||||
private static void addAttributesIfNotNull(Set<AnnotationAttributes> result, Map<String, Object> attributes) {
|
||||
if (attributes != null) {
|
||||
result.add(AnnotationAttributes.fromMap(attributes));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ import static java.lang.annotation.RetentionPolicy.*;
|
|||
* which is enabled by default.
|
||||
*
|
||||
* <p>The configuration options provided by this annotation are equivalent to
|
||||
* those supported by {@link ScriptUtils} and {@link org.springframework.jdbc.datasource.init.ResourceDatabasePopulator
|
||||
* ResourceDatabasePopulator} but are a superset of those provided by the
|
||||
* {@code <jdbc:initialize-database />} XML namespace element. Consult the
|
||||
* Javadoc of individual attributes in this annotation for details.
|
||||
* those supported by {@link ScriptUtils} and
|
||||
* {@link org.springframework.jdbc.datasource.init.ResourceDatabasePopulator}
|
||||
* but are a superset of those provided by the {@code <jdbc:initialize-database/>}
|
||||
* XML namespace element. Consult the javadocs of individual attributes in this
|
||||
* annotation for details.
|
||||
*
|
||||
* <p>Beginning with Java 8, {@code @Sql} can be used as a
|
||||
* <em>{@linkplain Repeatable repeatable}</em> annotation. Otherwise,
|
||||
|
|
@ -85,7 +86,7 @@ public @interface Sql {
|
|||
* The configured SQL scripts will be executed <em>after</em> the
|
||||
* corresponding test method.
|
||||
*/
|
||||
AFTER_TEST_METHOD;
|
||||
AFTER_TEST_METHOD
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -98,10 +99,8 @@ public @interface Sql {
|
|||
|
||||
/**
|
||||
* The paths to the SQL scripts to execute.
|
||||
*
|
||||
* <p>This attribute may <strong>not</strong> be used in conjunction with
|
||||
* {@link #value}, but it may be used instead of {@link #value}.
|
||||
*
|
||||
* <h3>Path Resource Semantics</h3>
|
||||
* <p>Each path will be interpreted as a Spring
|
||||
* {@link org.springframework.core.io.Resource Resource}. A plain path
|
||||
|
|
@ -114,7 +113,6 @@ public @interface Sql {
|
|||
* {@link ResourceUtils#CLASSPATH_URL_PREFIX classpath:},
|
||||
* {@link ResourceUtils#FILE_URL_PREFIX file:}, {@code http:}, etc.) will be
|
||||
* loaded using the specified resource protocol.
|
||||
*
|
||||
* <h3>Default Script Detection</h3>
|
||||
* <p>If no SQL scripts are specified, an attempt will be made to detect a
|
||||
* <em>default</em> script depending on where this annotation is declared.
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public class AnnotationConfigDispatcherServletInitializerTests {
|
|||
|
||||
@Override
|
||||
protected Class<?>[] getServletConfigClasses() {
|
||||
return new Class[]{MyConfiguration.class};
|
||||
return new Class<?>[] {MyConfiguration.class};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -254,16 +254,12 @@ public class AnnotationConfigDispatcherServletInitializerTests {
|
|||
}
|
||||
|
||||
|
||||
private static class MyBean {
|
||||
public static class MyBean {
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@SuppressWarnings("unused")
|
||||
private static class MyConfiguration {
|
||||
|
||||
public MyConfiguration() {
|
||||
}
|
||||
public static class MyConfiguration {
|
||||
|
||||
@Bean
|
||||
public MyBean bean() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue