'Is there any way to have a single Spring Boot API for accepting 'application/json' input & 'application/x-www-form-urlencoded' input
I have to expose an API (Java Spring boot) that can accept both JSON & x-www-form-urlencoded types.
For an API to accept JSON, we annotate with @RequestBody which does not work with form-urlencoded type requests. For the form-urlencoded requests, we have to annotate with @ModelAttribute which will not help in JSON requests.
Please suggest if there is any common way to handle both request types? I use spring-boot 1.5.6 for API development.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
