Skip to content

Feign Inheritance has conflicts with the web mvc #564

@terminux

Description

@terminux

When I use Feign Inheritance, I get the following errors:

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'xxxx.UserClient' method 
xxx.UserClient#getUser(Long)
to {GET [/v1/users/{id}]}: There is already 'userResource' bean method
xxx.UserResource#getUser(Long) mapped.
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.validateMethodMapping(AbstractHandlerMethodMapping.java:662)

Because I added the @RequestMapping annotation on the UserService class, just like that:

@RequestMapping("/v1")
public interface UserService {

    @RequestMapping(method = RequestMethod.GET, value ="/users/{id}")
    User getUser(@PathVariable("id") long id);
}

So Spring MVC thinks that UserClient is also a handler,This will conflict with the UserResource.

Can I submit a pull request to fix this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions