Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 82 microservices projects each containing its own microservice For brevitys sake we will create them in the same repository We will create a routes project for the route calculation service a bookings project for the booking service and a ui project for the front end We will also add a module that will hold our JPA entities models and a module that will hold our utils because they will be shared with our three microservices Note In realworld projects it is generally recommended to use a separate repository for each microservice so that they are treated as separate entities and have separate versioning and revision history as well as separate deployment We will also create the topmost pom xml file You can look at the project structure and the pom xml file by downloading the source code for this project from GitHub To create our microservice projects we will use Maven archetype generation mvn B archetype generate for all modules This will generate the three projects we require Adding KumuluzEE Now we need to add the appropriate dependencies to the KumuluzEE framework KumuluzEE is completely modular which means that apart from the core functionality each Java EE component is packaged as a separate module and must be included explicitly as a dependency in order to be used KumuluzEE will automatically detect which modules are included in the classpath and properly configure them We include KumuluzEE by defining the appropriate dependency in Maven It is recommended that we define a property with the current version of KumuluzEE and use it with every dependency properties kumuluzee version 200 kumuluzee version properties Adding the Front End UI Service Lets start with the ui microservice and include the core KumuluzEE module for bootstrapping the logic and configuration It provides the com kumuluz ee EeApplication class with the main method that will bootstrap our app We will also include the servlet and the HTTP server We will use a Jetty servlet implementation which is known for its high performance and small footprint The ui pom xml file contains this dependency groupId com kumuluz ee groupId artifactId kumuluzee core artifactId version kumuluzee version version dependency dependency groupId com kumuluz ee groupId artifactId kumuluzee servlet jetty artifactId version kumuluzee version version dependency We must also include the maven dependency plugin in our pom xml file which will copy all our dependencies together with the classes So we add the following to the ui pom xml file plugin groupId org apache maven plugins groupId artifactId maven dependency plugin artifactId version 210 version executions execution id copy dependencies id phase package phase goals goal copy dependencies goal goals execution
You must have JavaScript enabled to view digital editions.