spring-cloud / spring-cloud-openfeign

Support for using OpenFeign in Spring Cloud apps
Apache License 2.0
1.22k stars 786 forks source link

SpringQueryMap stopped working with @Param after the version Hoxton.SR12/2.2.9.RELEASE #649

Closed grisotto closed 1 year ago

grisotto commented 2 years ago

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.

OlgaMaciaszek commented 2 years ago

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.

grisotto commented 2 years ago

Hi, it's not working. I tried with 2021.0.0 and spring-boot 2.6.2.

liununu commented 2 years ago

Hi @grisotto , Refer to the related implement BeanQueryMapEncoder.java. Maybe you could try to put the @Param("id_credit") on the getter method.

OlgaMaciaszek commented 1 year ago

@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.

spring-cloud-issues commented 1 year ago

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.

grisotto commented 1 year ago

Thank you