Closed
Description
Hello there!
The problem is with the Spring-boot-web.
Spring boot version '2.2.1.RELEASE'
The bug :
If you got interface, an abstract class and implement class, the @RequestBody
annotation will not be taken to the implemented class.
Example:
public interface TheControllerInterface {
@PostMapping("/test")
public String returnString(@RequestBody SomeKindOfObject object);
}
public abstract class AbstractController implements TheControllerInterface {
// It might be empty right now, but in overall I had the implementation of few methods here EXCLUDING the one in interface.
}
@RestController
@RequestMapping("/springTest")
public class Controller extends AbstractController {
@Override
public String returnString(SomeKindOfObject object) {
//implementation of method.
}
}
After checking the url endpoint /springTest/test you will see that it does not have body.
Those informations will go to @RequestParam
annotation instead of @RequestBody
annotation.
The url will be inheritated. Just the @RequestBody
annotation will not.
Best!
PS. It looks like somebody has RequestBody username in github, to using "@" with Annotation name will provide link to that username :(