Skip to content

Commit c76d681

Browse files
committed
Merge branch '6.1.x'
2 parents 4149d5c + de828e9 commit c76d681

File tree

1 file changed

+44
-5
lines changed
  • spring-test/src/main/java/org/springframework/test/context/jdbc

1 file changed

+44
-5
lines changed

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

+44-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -171,28 +171,67 @@
171171
enum ExecutionPhase {
172172

173173
/**
174-
* The configured SQL scripts and statements will be executed
175-
* once per test class <em>before</em> any test method is run.
174+
* The configured SQL scripts and statements will be executed once per
175+
* test class <em>before</em> any test method is run.
176+
* <p>Specifically, the configured SQL scripts and statements will be
177+
* executed prior to any <em>before class lifecycle methods</em> of a
178+
* particular testing framework &mdash; for example, methods annotated
179+
* with JUnit Jupiter's {@link org.junit.jupiter.api.BeforeAll @BeforeAll}
180+
* annotation.
181+
* <p>NOTE: Configuring {@code BEFORE_TEST_CLASS} as the execution phase
182+
* causes the test's {@code ApplicationContext} to be eagerly loaded
183+
* during test class initialization which can potentially result in
184+
* undesired side effects. For example,
185+
* {@link org.springframework.test.context.DynamicPropertySource @DynamicPropertySource}
186+
* methods will be invoked before {@code @BeforeAll} methods when using
187+
* {@code BEFORE_TEST_CLASS}.
176188
* @since 6.1
189+
* @see #AFTER_TEST_CLASS
190+
* @see #BEFORE_TEST_METHOD
191+
* @see #AFTER_TEST_METHOD
177192
*/
178193
BEFORE_TEST_CLASS,
179194

180195
/**
181-
* The configured SQL scripts and statements will be executed
182-
* once per test class <em>after</em> all test methods have run.
196+
* The configured SQL scripts and statements will be executed once per
197+
* test class <em>after</em> all test methods have run.
198+
* <p>Specifically, the configured SQL scripts and statements will be
199+
* executed after any <em>after class lifecycle methods</em> of a
200+
* particular testing framework &mdash; for example, methods annotated
201+
* with JUnit Jupiter's {@link org.junit.jupiter.api.AfterAll @AfterAll}
202+
* annotation.
183203
* @since 6.1
204+
* @see #BEFORE_TEST_CLASS
205+
* @see #BEFORE_TEST_METHOD
206+
* @see #AFTER_TEST_METHOD
184207
*/
185208
AFTER_TEST_CLASS,
186209

187210
/**
188211
* The configured SQL scripts and statements will be executed
189212
* <em>before</em> the corresponding test method.
213+
* <p>Specifically, the configured SQL scripts and statements will be
214+
* executed prior to any <em>before test lifecycle methods</em> of a
215+
* particular testing framework &mdash; for example, methods annotated
216+
* with JUnit Jupiter's {@link org.junit.jupiter.api.BeforeEach @BeforeEach}
217+
* annotation.
218+
* @see #BEFORE_TEST_CLASS
219+
* @see #AFTER_TEST_CLASS
220+
* @see #AFTER_TEST_METHOD
190221
*/
191222
BEFORE_TEST_METHOD,
192223

193224
/**
194225
* The configured SQL scripts and statements will be executed
195226
* <em>after</em> the corresponding test method.
227+
* <p>Specifically, the configured SQL scripts and statements will be
228+
* executed after any <em>after test lifecycle methods</em> of a
229+
* particular testing framework &mdash; for example, methods annotated
230+
* with JUnit Jupiter's {@link org.junit.jupiter.api.AfterEach @AfterEach}
231+
* annotation.
232+
* @see #BEFORE_TEST_CLASS
233+
* @see #AFTER_TEST_CLASS
234+
* @see #BEFORE_TEST_METHOD
196235
*/
197236
AFTER_TEST_METHOD
198237
}

0 commit comments

Comments
 (0)