Add consumes and produces to HTTP method annotations
See original GitHub issueCurrently, we have separate annotations to define consume and produce media types:
public class MyService {
@Post("/foo")
@Consumes("application/json")
@Produces(MediaTypeNames.JSON)
public HttpResponse foo(...) {
...
}
}
It’s a bit verbose, so it would be nice if we can specify them in one annotation:
public class MyService {
@Post(value = "/foo", consumes = "application/json", produces = MediaTypeNames.JSON)
public HttpResponse foo(...) {
...
}
}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Using @Consumes and @Produces to Customize Requests ...
The @Produces annotation is used to specify the MIME media types or representations a resource can produce and send back to the client....
Read more >@Consumes and @Produces - Java EE: RESTful Service with ...
- [Instructor] All resource methods can consume and produce content of almost any type. If you make a post request to a URI...
Read more >When I put @Consumes and @Produces in post or get?
1 Answer 1 ... @Consumes and @Produces simply tell what media type the HTTP method takes in and returns. so maybe your HTTP...
Read more >REST Annotations
Applicable on fields or getter/setter of any field REST DTO. This annotation adds HATEOAS links for POST methods on the returned XML or...
Read more >How to Set JSON Content Type In Spring MVC - Baeldung
How to Set JSON Content Type In Spring MVC ; @RequestMapping(value = "/greetings", method = RequestMethod.POST, consumes="application/json") ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh, I was rather thinking that all defined ways are applied.
Ok then let’s close this issue. Thank you guys for the opinions. 😄