62758896

Date: 2020-07-06 16:08:50
Score: 6.5
Natty:
Report link

I have simillar problem and list of URI will not help. I have an object O that I should transfer to ServiceA or ServiceB depending of the manager of this object. So I defined an interface for Service and extend it to ServiceA and ServiceB.

@RequestMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.TEXT_PLAIN_VALUE)
public interface MyService {
    @PutMapping("/publish")
    String publish();
}

@FeignClient(name = "ServiceA")
public interface ServiceA extends MyService {
}

@FeignClient(name = "ServiceB")
public interface ServiceB extends MyService {
}

Starting the app results in the error :

Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'ServiceA' method ServiceA#publish() to {PUT /publish, consumes [application/json], produces [text/plain]}: There is already 'ServiceB' bean method ServiceB#publish() mapped.

Do you have any idea what I'm doing wrong or if what I do is not possible with Feign ?

Reasons:
  • Blacklisted phrase (2): Do you have any idea
  • RegEx Blacklisted phrase (2): Do you have any idea
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Rieper