An example application for my book The Java Module System. The Service Monitor is an application that observes a hypothetical network of microservices by
- contacting individual services
- collecting and aggregating diagnostic data into statistics
- persisting statistics
- making statistics available via REST
It is split into a number of subprojects that focus on specific concerns.
Each project has its own directory that contains the known folder structure, e.g. src/main/java
.
It was developed as a Java 8 application and now needs to be made compatible with Java 9+ and then be modularized.
Each of the branches contains a different version of the project:
master
: starting point, Java 8migrated
: compatible with Java 9 to 11modularized
: partially modularized
In the project's root folder:
- to build:
mvn clean install
- to run:
java -cp 'app/*' monitor.Main
- to contact REST endpoints:
curl http://localhost:4567/stats/json
curl http://localhost:4567/stats/json64 | base64 -d
curl http://localhost:4567/stats/xml
Here's what you're facing. (If you get stuck, check the guide.)
- internal
BASE64Encoder
is gone ~> useBase64.getEncoder
instead - JAXB API is not present ~> add java.xml.bind
- Common annotations are not present ~> add java.xml.ws.annotations
- split package:
javax.annotation
between java.xml.ws.annotations and jsr-305 ~> patch java.xml.ws.annotations - old version of Mockito causes warnings ~> update to newer version, e.g. 2.8.47
- application class loader is no longer a
URLClassLoader
~> use system propertyjava.class.path
- even new version of Mockito may cause problems ~> update to yet newer version, e.g. 2.18.3
- ASM dependency of Maven compiler plugin may cuase problems ~> update to newer version, e.g. 6.1.1
- Java EE modules were removed ~> add third-party dependencies