I have following structure (maven)
Parent:
- Common (module)
- Server (module)
- Batch (module)
- All (Batch, Server) sees Common
- Batch sees Server (and Common transitively: Batch -> Server -> Common)
For IntegrationTests to loading an ApplicationContext (spring context is needed) i need something like this:
@ContextConfiguration(classes = Application.class)
Application.class is main SpringBoot class (in Common module)
@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);
}
}
Now i want have other @Configuration for Batch module:
@Configuration
public class BatchConfiguration {
@Bean
public Service1 service1() {
...
}
@Bean
public Service2 service2() {
...
}
}
In above config i can't import BatchConfiguration in Application.
How initialize beans: service1, service2?