'Cannot infer type arguments for ResponseEntity
I am trying to return the response as string from my function using ResponseEntity but getting an error. I tried this:
@GetMapping(value="/getuserip")
public ResponseEntity<Object> getUserData(@RequestParam("username") String userName, HttpServletRequest request){
String ipAddr = (request.getHeader("X-FORWARDED-FOR"));
return new ResponseEntity<>(ipAddr, HttpStatus.SC_ACCEPTED);
}
When trying to return the String variable ipAddr I am getting the error. Do you know how to fix this?
Solution 1:[1]
The library for httpstatus was giving this error in my case. Fixed it by replacing org.apache.http.HttpStatus with org.springframework.http.HttpStatus.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lrrr |
