You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Mvc Annotations in argument of a method (like @Path) annotated with @RequestMapping are not supported when you create a @RestController via an Interface [SPR-14805] #19371
Spring Mvc Annotations in argument of a method (like @Path) annotated with @RequestMapping are not supported when you create a @RestController implementation via an Interface annotated
@RestController("userRestControllerV2")
public class UserRestController implements UserResource {
public static final String API_URL = "/api/users";
public User getUser(String userId) {
return new User(userId);
}
}
You have to change the implementation to
public User getUser(@PathVariable("id") String userId) {
return new User(userId);
}
to have a work around. The different annotation (like @RequestMapping) on class / method are well recognized.
I really want to use all the annotations in the interface in order to use the same interface between the server (implemented via @RestController) and the client (implemented feign via spring-cloud). Very useful when you develop many microservices via spring-boot and spring-cloud (eureka).