草庐IT

ContextConfigurations

全部标签

spring - 如何在 SpringJunit4TestRunner 中将 @ComponentScan 与特定于测试的 ContextConfigurations 一起使用?

我正在测试一个SpringBoot应用程序。我有几个测试类,每个测试类都需要一组不同的模拟或其他自定义bean。这是设置的草图:src/main/java:packagecom.example.myapp;@SpringBootApplication@ComponentScan(basePackageClasses={MyApplication.class,ImportantConfigurationFromSomeLibrary.class,ImportantConfigurationFromAnotherLibrary.class})@EnableFeignClients@Enab

spring - 如何在 SpringJunit4TestRunner 中将 @ComponentScan 与特定于测试的 ContextConfigurations 一起使用?

我正在测试一个SpringBoot应用程序。我有几个测试类,每个测试类都需要一组不同的模拟或其他自定义bean。这是设置的草图:src/main/java:packagecom.example.myapp;@SpringBootApplication@ComponentScan(basePackageClasses={MyApplication.class,ImportantConfigurationFromSomeLibrary.class,ImportantConfigurationFromAnotherLibrary.class})@EnableFeignClients@Enab