Recommended structure - overview
Microservices projects contains many modules, as every microservice is a seperate application. We recommend to use Maven Reactor to connect everything for easy management. JLupin Platofrm supports two types of microservices: native and servlet. Both of them could have some special configuration special for their type (for example servlet microservices are repackaged by spring-boot-maven-plugin instead of jlupin-platform-maven-plugin). Due to this fact it is good idea to have common file for each of them. We also recommend to split microservices into interfaces and implementation. Of course servlet microservices does not share their interfaces classes, because controllers are their entry points. They can share specification of endpoints and their input objects with other developers. For global pojo classes and utils special modules are also recommended. Due to fact that testing such system requires microservices to interact with each ohter you should think about module for integration testing.
Let's assume we will create a project named
example-project with 2 microservices. One will be named
example-native and will be native micorservice. Second one will be named
example-servlet and will be servlet microservice. Below recommended structure of such a project is shown (only pom files are included without standard java directories).
+ example-project | +--+ common-pojo | | | +--- pom.xml | +--+ common-util | | | +--- pom.xml | +--+ example-native | | | +--- additional-files | | | +--+ implementation | | | | | +--- pom.xml | | | +--+ interfaces | | | +--- pom.xml | +--+ example-servlet | | | +--- additional-files | | | +--+ implementation | | | +--- pom.xml | +--+ integration-test | | | +--- pom.xml | +--- native-pom.xml | +--- servlet-pom.xml | +--- pom.xml
Go to next chapters to see content of pom file you want. You will also find there detailed description.