Skip to content

Commit c6f6e19

Browse files
committed
Support @SQL as a merged composed annotation
Issue: SPR-13973
1 parent d572b02 commit c6f6e19

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@
5050
* multiple instances of {@code @Sql}.
5151
*
5252
* <p>This annotation may be used as a <em>meta-annotation</em> to create custom
53-
* <em>composed annotations</em>; however, attribute overrides are not currently
54-
* supported for {@linkplain Repeatable repeatable} annotations that are used as
55-
* meta-annotations.
53+
* <em>composed annotations</em>.
5654
*
5755
* @author Sam Brannen
5856
* @since 4.1

spring-test/src/main/java/org/springframework/test/context/jdbc/SqlScriptsTestExecutionListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -26,7 +26,7 @@
2626
import org.apache.commons.logging.LogFactory;
2727

2828
import org.springframework.context.ApplicationContext;
29-
import org.springframework.core.annotation.AnnotationUtils;
29+
import org.springframework.core.annotation.AnnotatedElementUtils;
3030
import org.springframework.core.io.ByteArrayResource;
3131
import org.springframework.core.io.ClassPathResource;
3232
import org.springframework.core.io.Resource;
@@ -129,10 +129,10 @@ public void afterTestMethod(TestContext testContext) throws Exception {
129129
private void executeSqlScripts(TestContext testContext, ExecutionPhase executionPhase) throws Exception {
130130
boolean classLevel = false;
131131

132-
Set<Sql> sqlAnnotations = AnnotationUtils.getRepeatableAnnotations(testContext.getTestMethod(), Sql.class,
132+
Set<Sql> sqlAnnotations = AnnotatedElementUtils.getMergedRepeatableAnnotations(testContext.getTestMethod(), Sql.class,
133133
SqlGroup.class);
134134
if (sqlAnnotations.isEmpty()) {
135-
sqlAnnotations = AnnotationUtils.getRepeatableAnnotations(testContext.getTestClass(), Sql.class,
135+
sqlAnnotations = AnnotatedElementUtils.getMergedRepeatableAnnotations(testContext.getTestClass(), Sql.class,
136136
SqlGroup.class);
137137
if (!sqlAnnotations.isEmpty()) {
138138
classLevel = true;

0 commit comments

Comments
 (0)