для объяснения проблемы: < /p>
setupa < /strong>: < /p>
@SpringBootApplication
public class SetupA {
public static void main(String[] args) {
SpringApplication.run(SetupA.class, args);
}
static {
System.out.println("============================ setup of A ====================================");
// Containers to startup for setup A
}
}
< /code>
@SpringBootTest(classes = SetupA.class)
public class BaseATest {
}
< /code>
class SetupATests extends BaseATest {
@Test
void testA() {
System.out.println("============================ executed A test ====================================");
}
}
< /code>
setupB
@SpringBootApplication
public class SetupB {
public static void main(String[] args) {
SpringApplication.run(SetupB.class, args);
}
static {
System.out.println("============================ setup of B ====================================");
// Containers to startup for setup B
}
}
< /code>
@SpringBootTest(classes = SetupB.class)
public class BaseBTest {
}
< /code>
class SetupBTests extends BaseBTest{
@Test
void testB() {
System.out.println("============================ executed B test ====================================");
}
}
< /code>
code also available at https://github.com/koenv-star/springboo ... roblem.git
Using this setup in spring boot 3.3.4 if we ran the tests of setupA we see both the statics blocks get executed:

while in sb 3.4.5. only the static block of B gets executed:

Why is this suddenly different?
Also, important to mention that starting the containers in a static block it was probably not the best usecase because all the static blocks ran and all the containers started but still want to know what introduced the different behavior between the SB versions.
Подробнее здесь: https://stackoverflow.com/questions/796 ... estclasses