In my Spring Boot application I added an API
@RequestMapping(value = "/abc/{input}", method=RequestMethod.GET)
@ResponseBody
public WhitelistStatus getInput(@PathVariable("input") String input);
I deployed this application and made a call - http://localhost:8080/abc/123
I put a debug point in my code and the path variable input which should be "123" always comes as null.
I've been trying to resolve this for sometime now. There is no ambiguity in the URL as this is the only API. Can someone please tell me what I'm doing wrong here?
Well I found the issue. I have to add @PathVariable annotation in the implementation method as well. I only had it in the interface first And it works!
I had same issue,but now its solved.
Add @PathVariable at class level as well because PathVariable is not inherited from interface thats why it is not working.
Add(at implementing class level) :-
public WhitelistStatus getInput(@PathVariable("input") String input){
// implementation code here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With