Different artifacts for cloud and on-premise deployment

Viewed 193

What are some best-practices for a Spring-Boot project, which creates two artifacts (one for cloud and one for on-premise deployment), where just some Spring Beans are implemented differently (e.g. for login, etc.) and the artifacts should not contain code from the other deployment? What are best-practices to unit test and integration test those instances without long build time due to executing tests multiple times?

3 Answers

Test services without spring context (so you don't have to choose between different contexts in tests, also test times will be smaller) - these will be simple unit tests. Use spring test context for integrational tests with these specific Spring Beans.

You will be building libraries like in the below given model. All the features will be abstracted like microservices which can be developed, tested, the main framework will have integration tests to the external services and the core application will have it's own tests.

Loosely Couple features with Unit Tests and Integration

Please try to create a config file with @Profile("cloud") annotation.

Please look the following links.

Example

Hoping this helps. As in this way you can configure all your environments.

Related