0

I have following structure (maven)

Parent:

  • Common (module)
  • Server (module)
  • Batch (module)

  1. All (Batch, Server) sees Common
  2. 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?

Artur
  • 217
  • 1
  • 5
  • 12
  • Are you getting any errors? Also what do you mean by you cant import BatchConfiguration in Application? – johncena May 05 '17 at 01:10
  • Application is in the Common module, BatchConfiguration is in the Batch module. So 'Common' module don't sees 'Batch' module (impossible by dependency management in maven config). – Artur May 05 '17 at 08:05

0 Answers0