spring-cloud-openfeign icon indicating copy to clipboard operation
spring-cloud-openfeign copied to clipboard

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

Open grisotto opened this issue 3 years ago • 3 comments
trafficstars

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.

grisotto avatar Dec 20 '21 12:12 grisotto

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.

OlgaMaciaszek avatar Dec 23 '21 10:12 OlgaMaciaszek

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

grisotto avatar Jan 27 '22 13:01 grisotto

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

liununu avatar Mar 24 '22 17:03 liununu

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

OlgaMaciaszek avatar Mar 09 '23 13:03 OlgaMaciaszek

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.

spring-cloud-issues avatar Mar 16 '23 13:03 spring-cloud-issues

Thank you

grisotto avatar Mar 16 '23 14:03 grisotto