Starter for the Java Education exercises
microservice-root
--api Jax-RS resources (REST)
--api-integration-test Integration Tests for Jax-RS resources (REST)
--dao Entitymanager/QueryDSL/JPA Services layer
--logger Logging (No need to modify)
--model Entities/JPA models
--resources Documentation and SQL scripts
--web This is where the artifact is combined and created for deployment
Note: the context root in weblogic.xml
is: /education
so the URL after deploying locally is: http://localhost:7001/education
Tip: Do this part with your coach, because they have done it many times.
- Open cloned GIt repo in Intellij
- Click edit configuration (next to run button)
- Click
+
to add a configuration for the Application Server - Add your local WLS doman to the
domainpath
for example:D:\Oracle\Middleware_*\user_projects\base_domain
- Add the username and password for the admin user which was configured during the WLS installation
- In the deployment tab, click add and add the
web:war
- Apply
To build the starter run clean install
on the root project through Maven in Intellij, or in the terminal run:
mvn clean install -U
Make sure the build command is run on the root folder.
Now run the build deployment using the Run configuration (top right), navigate to:
http://localhost:7001/education/api/dummy
in the browser when it is running. You should get the following response:
cdi-injected
If you get the correct response, feel free to start the exercises, ask your coach to help you with the setup part until you get the correct response.
If you are comfortable using the Java debugger in Intellij, here is how to configure it for the exercises. If you have not used a debugger before, just skip this step for now, it is not essential.
Edit the WLS run configuration with the following VM options:
-server -Xrs -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=3999,server=y,suspend=n -Djava.compiler=NONE
- Go to the run configuration in the top right (Same as Weblogic)
- Click
+
and chooseRemote
- Give it a name such as
Debug
- Change the port to
3999
(same as in VM options) - Apply
To debug: select the debug option and click the debug icon (default keyboard shortcut: Shift+F9)
Hints for the JPA Exercises:
- model/src/main/resources/META-INF/persistence.xml needs to be configured correctly
- Add Entities to the
model
module - Add the Dao's (exercises related to the EntityManager) to the
dao
module
Hints for the JAX-RS (REST) exercises:
- Add all resources to the
api
module and test them inapi-integration-test
- Endpoints need to be added to the
ApplicationConfig
Hints for the JSON parsing exercises:
- Register Jackson with Jax-RS in the
ApplicationConfig
- Perform the exercises in the
api
module
Hints for the CDI exercisees:
- Perform the exercises in the
api
module - Remember to register the interceptors
To verify all learning goals have been achieved, a final exercise can determine whether all subjects have been sufficiently mastered. The exercise consists of creating a micro-service from scratch, with a connection to the Database and REST-endpoints to interact with the micro-service.
- Connection with a database with several tables
- Entities configured correctly to reflect schema
- EntityManager is used to persist and remove data from the Database
- QueryDsl is used to fetch data from the database
- Rest endpoints are available to receive data from the database in JSON format
- Rest endpoints are available to update data on the database through JSON input
- Rest endpoints validate the incoming JSON input
- Rest endpoints are available to remove data from the database
- Integration tests verify the rest endpoints are working correctly
If an application has been created from scratch which demonstrates above functionality, the basics have been sufficiently mastered.
It is not necessary to complete the final exercise in one go, or in a certain amount of time. Nor is it necessary to complete the assignment completely on your own, feel free to ask your team-members to explain certain parts if you are stuck. Team-members however, cannot write the code for you, they can help and explain but they cannot solve it for you. Pairing is fine as long as you are the one doing the typing and understand what you are typing and why.
Discuss the approach with your coach and team-lead to come up with a personal approach to the final exercise that matches the situation you are in.