Hello team,

Just wanted to reach out with an issue / enhancement request. Spring introduced the http interface (http exchange) a while back. This is a very cool feature, and if not anything else, just wanted to say thanks for this feature.

In the case where the server is accepting many parameters, this construct

    @GetExchange("/api/v3/projects")
    Mono<MyResponse> question(@RequestParam String firstParam, @RequestParam String secondParam, @RequestParam String ... , @RequestParam String twentyParam);

Shows many drawbacks (such as having many arguments).

Another approach is to use a map construct, something like this:

        Map<String, Object> queryParams = new HashMap<>();
        queryParams.put("firstParam", "firstParamValue");
        queryParams.put("secondParam", "secondParamValue");
        ...
        queryParams.put("twentyParam", "twentyParamValue");
 @GetExchange("/api/v3/projects")
    Mono<MyResponse> question(@RequestParam Map<String, Object> queryParams);

In the spirit of Spring, I was also hoping I could do something like this:

public record MyQueryParameters(String firstParam, String secondParam, [...], String twentyParam) {
}
@GetExchange("/api/v1.0/question")
    Mono<MyResponse> question(@RequestParam MyQueryParameters myQueryParameters);

Unfortunately, this is yielding this error, which I would like to report.

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [@org.springframework.web.bind.annotation.RequestParam com.example.MyQueryParameters] to type [java.lang.String]
    at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:294) ~[spring-core-6.2.3.jar:6.2.3]
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
    *__checkpoint ⇢ HTTP GET "..." [ExceptionHandlingWebHandler]
Original Stack Trace:
        at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:294) ~[spring-core-6.2.3.jar:6.2.3]
        at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:185) ~[spring-core-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver.addSingleValue(AbstractNamedValueArgumentResolver.java:199) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver.addSingleOrMultipleValues(AbstractNamedValueArgumentResolver.java:179) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.AbstractNamedValueArgumentResolver.resolve(AbstractNamedValueArgumentResolver.java:97) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.HttpServiceMethod.applyArguments(HttpServiceMethod.java:142) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.HttpServiceMethod.invoke(HttpServiceMethod.java:132) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.web.service.invoker.HttpServiceProxyFactory$HttpServiceMethodInterceptor.invoke(HttpServiceProxyFactory.java:243) ~[spring-web-6.2.3.jar:6.2.3]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.2.3.jar:6.2.3]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223) ~[spring-aop-6.2.3.jar:6.2.3]
        at jdk.proxy2/jdk.proxy2.$Proxy52.question(Unknown Source) ~[na:na]

Would it be possible to accept an enhancement request on http interface http exchange, to be able to take into account an object as the parameters?

Thank you for your time.

Comment From: patpatpat123

Thanks you @snicoll

Comment From: rstoyanchev

Thanks for the request. We have an issue for this already, #32142.

Comment From: patpatpat123

Thank you @rstoyanchev , I didn't know there is a tracker already.

Good day!