FeignClient with @SpringQueryMap, but changing the parameter name using the @Param.
My dependencies:
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR12</version>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
FeignClient
@FeignClient(name = "myfeignclient", url = "${api.url}")
public interface UserClient {
@GetMapping("users")
ResponseEntity<UserProperties> getUserProperties(
@SpringQueryMap UserRequestParameter requestParameters);
}
Object
public class UserRequestParameter {
@Param("id_credit")
private Integer idCredit;
...
I was expected to build the url like this:
http://localhost/users?id_credit=1
but its was built this way:
http://localhost/users?idCredit=1
This started in the version Hoxton.SR11. Before this version, its was working.
Comment From: OlgaMaciaszek
Hello, @grisotto. The Hoxton release train is no longer supported. I have tested it on the currently supported versions of Spring Cloud (2021.0.0 and 2020.0.5) and it worked fine. Please upgrade to a supported version and let us know if you still experience any issues.
Comment From: grisotto
Hi, it's not working. I tried with 2021.0.0 and spring-boot 2.6.2.
Comment From: liununu
Hi @grisotto ,
Refer to the related implement BeanQueryMapEncoder.java. Maybe you could try to put the @Param("id_credit") on the getter method.
Comment From: OlgaMaciaszek
@grisotto - we were not able to reproduce this issue. if you would like us to take a closer look, please provide a minimal, complete, verifiable example that reproduces the issue.
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: grisotto
Thank you