我有以下结构(maven)
父:
对于IntegrationTests来加载ApplicationContext(需要弹簧上下文),我需要这样的东西:
@ContextConfiguration(classes = Application.class)
Application.class是主要的SpringBoot类(在Common模块中)
@SpringBootApplication
@ComponentScan(basePackages = "com.domain")
@EnableJpaRepositories("pl.domain.repository")
@EntityScan("pl.domain.model")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
现在我想要批量模块的其他@Configuration:
@Configuration
public class BatchConfiguration {
@Bean
public Service1 service1() {
...
}
@Bean
public Service2 service2() {
...
}
}
在上面的配置中,我无法在Application中导入BatchConfiguration。
如何初始化bean:service1,service2?