After updating from 4.0.x to 4.1.4 I've noticed that my services cannot startup due to:
Caused by: java.lang.IllegalArgumentException: Negated params are not supported: !sync at org.springframework.cloud.openfeign.support.SpringMvcContract.parseParams(SpringMvcContract.java:372) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at org.springframework.cloud.openfeign.support.SpringMvcContract.processAnnotationOnMethod(SpringMvcContract.java:249) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:112) ~[feign-core-13.5.jar:na] at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:198) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:71) ~[feign-core-13.5.jar:na] at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:140) ~[feign-core-13.5.jar:na] at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:59) ~[feign-core-13.5.jar:na] at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:51) ~[feign-core-13.5.jar:na] at feign.Feign$Builder.target(Feign.java:202) ~[feign-core-13.5.jar:na] at org.springframework.cloud.openfeign.DefaultTargeter.target(DefaultTargeter.java:30) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:504) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:456) ~[spring-cloud-openfeign-core-4.1.4.jar:4.1.4] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:182) ~[spring-beans-6.1.15.jar:6.1.15] ... 29 common frames omitted
Changes were introduced by https://github.com/spring-cloud/spring-cloud-openfeign/commit/c276f1c6d4771082c44fc75932364f7192a8b5a7#diff-d7125c419c7e91db20fe7e903b744c180165b6271b6d68e5b966760eb1a3c067.
Is there any way to disable this check in SpringMvcContract? I understand that feign doesn't use negated parameters but I use shared interfaces between server and client. Negated parameters are needed on server side to avoid ambiguous mappings.
Comment From: ragnor
I've noticed that Spring Cloud OpenFeign is already in maintenance mode and I should migrate to Spring Interface Clients.
Is there any official guide how to perform migration?
Does Spring Cloud OpenFeign support *Exchange annotations (e.g. @HttpExchange) so as a first step in migration I can change mapping descriptions in interfaces?
Comment From: OlgaMaciaszek
Hello, @ragnor, thanks for creating the issue. We can consider it. Can you please provide a sample that illustrates your current scenario?
Comment From: ragnor
@OlgaMaciaszek a simple example to reproduce the issue:
public interface TokenApi {
@PostMapping(path = "/api/token", params = {"!expiration"})
String create();
@PostMapping(path = "/api/token", params = {"expiration"})
String create(@RequestParam LocalDateTime expiration);
}
@FeignClient(value = "token", url ="${feign.client.config.token.uri}", contextId = "tokenClient")
public interface TokenClient extends TokenApi {
}
@RestController
public class TokenController implements TokenApi {
@Override
public String create() {
// calculate token ...
return "a-token";
}
@Override
public String create(LocalDateTime expiration) {
// calculate token ...
return "a-token-with-expiration";
}
}
Comment From: kssumin
I'd like to contribute for this issue.
My proposed solution is to add a configuration option to allow negated parameters while maintaining backward compatibility.
@OlgaMaciaszek Please let me know if this solution aligns with the project's direction, and I'd be happy to submit a PR.