I've been playing around with the concept outlined in this answer, to share a common 'contract' between server and client. I'm trying to use this concept in a Spring MVC application that contains both REST endpoints and a Feign client. The @RequestMappings on the REST endpoints are picked up like normal by Spring, but: it also picks up the @RequestMapping on the abstract API class I use for my Feign client, i.e., in terms of the linked example, I have a UserService and UserClient in my code, and Spring picks up the @RequestMapping in the UserService class.
I don't understand why this happens in the first place, because:
- The
UserServiceclass is an interface. Why and how does Spring think it can map an endpoint to an interface method?? This will obviously never work. - The package containing
UserServiceis not included in thebasePackagelist of the@ComponentScanannotation on myApplicationclass
Any clues on how I can convince Spring to just ignore all classes in this package??