-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Extract Controller API to separate package #25494
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
Comments
@rolaca11 I believe this is a duplicate of #16747. Do you agree? If I understand correctly, your goal is to have an automatic client simply by pointing to an interface with |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I'm sorry for the late answer. |
Yes it does. I'm closing this as duplicate. |
Affects: All
There is a really nice consequence of how the official Jax-RS API is structured. Since the implementation of the Jax-RS API is not packaged with the API itself (obviously) there is a way to define REST APIs by creating a package, let's call it service-api so that not only the methods, but all the URI paths, the request methods, or even the accepted mime-types can be defined for every method in the service-api package.
Based on this package we can create the service-client and service-impl modules so that both packages instantly know how to communicate with eachother through the defined REST API and none of the API information needs to get duplicated.
A similar feature (although not necessarily bounded to REST APIs) could be achieved with the Spring framework by extracting the @controller, ResponseEntity and related annotations/classes to a different package.
It could be a nice addition to the way teams implement REST APIs. The reason a team might not want to use Jax-RS instead of Spring controller is that there are some nice features already in the Spring Controllers, for example, that the ResponseEntity can take a generic type, as opposed to the Jax-RS's Response, or the way Spring controllers handle exceptions.
Maybe the above description is a little cluttered, so I'll try and show an example of what I'm thinking about:
We have 3 packages: service-api, service-impl, service-client:
service-api.jar:
service-impl.jar:
service-client.jar:
The text was updated successfully, but these errors were encountered: