Java 如何在Sprint启动测试之间重用配置类?

Java 如何在Sprint启动测试之间重用配置类?,java,spring-boot,java-11,spring-boot-test,Java,Spring Boot,Java 11,Spring Boot Test,我有不同配置的spring启动测试: @SpringBootTest @Import({TestConfig1.class, TestConfig2.class}) class DemoApplication2Tests { Spring boot在启动每个测试类之前实例化TestConfig1.class中定义的bean。如何在测试类之间共享配置 (TestConfig1.class实例化了非常需要资源的docker容器,但这些测试需要sprint引导上下文中的一些差异) @SpringB

我有不同配置的spring启动测试:

@SpringBootTest
@Import({TestConfig1.class, TestConfig2.class})
class DemoApplication2Tests {

Spring boot在启动每个测试类之前实例化TestConfig1.class中定义的bean。如何在测试类之间共享配置

(TestConfig1.class实例化了非常需要资源的docker容器,但这些测试需要sprint引导上下文中的一些差异)

@SpringBootTest
@Import({TestConfig1.class, TestConfig3.class})
class DemoApplication3Tests {