-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only 1 JAX-RS application should be used per application #82
Comments
I can imagine maybe why this shortcut was taken: since this app is overloaded and used in multiple guides. At least one, JWT does use a separate front-end and back-end server for each service and also drags in the complexity of a multi-module Maven build. But agree, it can be confusing to realize how these paths are oddly-proliferating like you mentioned. Maybe there's a better way to share the core Java files across these different guide projects to use the appropriate number of JAX-RS apps for each guide? |
I don't think we should be optimizing for what is easiest to maintain via code re-use. Rather, we should be doing whatever makes the most sense for the guide. In this case, both JAX-RS "applications" are deployed in a single .war file on the same server, so there is no need for a front-end/back-end or multi-module app IMO. I would recommend having 1 JAX-RS Application with |
I was thinking about what you suggested, Andy, as an option too. Should still make a note of 1 JAX-RS Application per application and that system and inventory are conceptually separate and can (should) be in 2 separate apps. |
The problem is if you want 2 separate apps you must either package each separately or add the getClasses() method to each application class specifying the classes involved in each application. We talked about this and consider this to be a relatively ugly solution. Therefore I agree with Andy that this should be reduced to 1 JAX-RS application. Perhaps "system" and "inventory" should be added to their respective URL's with the 1 application given a more generic name. |
Came across this when I was looking at why my endpoints appeared for both paths. |
Currently this guide uses two different JAX-RS Applications, with different endpoints:
and
Having 2 JAX-RS applications is not really defined by the JAX-RS spec, and we should not be demonstrating this pattern in one of our guides.
It also gives a confusing behavior because all resources are available under both application endpoints. Namely
InventoryResource
is bound to both/system/systems/
AND/inventory/systems
. Likewise,SystemResource
is bound to both /system/propertiesAND
/inventory/properties`The text was updated successfully, but these errors were encountered: