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
{{ message }}
Repository navigation
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).
Activity
spring-projects-issues commentedon Oct 14, 2016
Juergen Hoeller commented
This looks like a duplicate of #15682 which we intend to tackle for 5.0.
spring-projects-issues commentedon Oct 14, 2016
Alexandre Navarro commented
Thanks, sorry for duplication.