I have a maven module which will handle DB interactions for various scenarios. I want this module to use spring framework so we can leverage the standard DI and integration test capabilities. This module will never run as it own application. Lets call this the DB module.

This module will be included as a dependency in a number of deployable application modules which use spring-boot to get easy access to various REST / Web interfaces. Lets call this will be the App module.

As I see it, the DB module will define the standard classes and @Autowire or @Resource JdbcTemplate objects. The integration tests of the DB module will define the full context for the module when running tests. I can use various test profiles at this level to switch between h2 and real DB's.

In the App module, we'll have a standard Config class which will declare the @Configuration annotation and then declare the various @Beans from the classes in the DB module.

Are there any guidelines or advise on how i should declare contexts or beans in these modules?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.