Though Jakarta EE is perfect for microservices, other options use the same bases and may be a little lighter in some scenarios.
The clearer (and my favorite) way of doing it is by using Eclipse MicroProfile (http://microprofile.io/). It has defined the path and the standards for microservices in the Enterprise Java ecosystem.
As a standard, it has some implementations. Please refer to some of them here:
- KumuluzEE (https://ee.kumuluz.com/): It's based on Jakarta EE and has many microservice must-have features, such as service discovery. It won a Duke Choice Awards prize, which is huge!
- Payara Micro (https://www.payara.fish/payara_micro): Payara is the company that owns a commercial implementation of Eclipse GlassFish, the Payara Server, and from this, the company created the Payara Micro. The cool thing about it is that it is just a 60 MB JAR file that you start using the command line and boom! Your microservice is running.
- Helidon (https://helidon.io): It's a collection of Java libraries for writing microservices that run on top of Netty. It comes in two flavors— Helidon SE (a microframework) and Helidon MP (MicroProfile implementation).
- Thoairntl (https://thorntail.io): This was created by Red Hat and derived from Wildfly Swarm.
One last note about the code covered in this recipe— it would be nice in a real-world solution to use a Data Transfer Object (DTO) to separate the database representation from the service one.