Will be happy if somebody pays attention and helps me to solve this issue.
Rest server:
@RestController
@RequestMapping("/")
public class RestServer {
@RequestMapping(value = "/foo/{bar}", method=RequestMethod.GET)
@ResponseBody
public List<UserEntity> getUsers(@PathVariable("bar") List<Object> criterions){
return UserService.getInstance().getUserList(criterions);
}
}
Rest client method:
public static void initUserMap(){
List<Object> criterions = new ArrayList<>();
criterions.add(Restrictions.eq("UserTypeId", 1));
final String url = "http://localhost:8080/getUsers/" + criterions;
RestTemplate restTemplate = new RestTemplate();
List<UserEntity> users = restTemplate.getForObject(url, UserEntity.class);
..........
..........
}
Cannot compile because of the error I get:
Error:(71, 62) java: incompatible types: inference variable T has incompatible bounds
equality constraints: testRest.UserEntity upper bounds: java.util.List<testRest.UserEntity>,java.lang.Object
How do I pass criterions from client method as a parameter to getUsers method in the server, so I get result, which is also a list of users?
Thanks in advance.