For the project I'm working on I was thinking to create a Java Module for each layer of my system:
servlet-presentationdefines the implementation of the presentation layer. It is composed by Java Servlets that call the layer below and by JSPs that represent the view (Also JS, CSS...)
businessrepresents the service classes of the application, that contains the business logic.
entity-apirepresents the entity classes and the interfaces for their repositories, to isolate the
businessmodule from infrastructure code.
entity-hibernaterepresents an implementation of
This is a simple approach that should do the trick for what I want to achieve: modularity for the presentation and persistence layer. (I may choose to add
resteasy-presentation one day, or
entity-eclipselink one day)
However, I'd also like a way to vertically partition the elements that compose my system for communication purposes. For this reason I wanted to use the plain old Java packages: classes in different layers that may adhere to the same use cases should be put in the same package. However, different Java Modules cannot have a package of the same name. What could be a way to achieve optimally split my codebase?