question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@QueryMap does not work with POJOs when used after @Param

See original GitHub issue

This kind of code (from https://github.com/OpenFeign/feign/pull/335/files#diff-13815c678552a275075ab18b17c67784R616):

@RequestLine("GET /?name={name}")
void queryMapWithQueryParams(@Param("name") String name, @QueryMap Map<String, Object> queryMap);

Does not work when @QueryMap is used on a POJO.

In my case, I was trying to use Spring’s Pageable like so:

@RequestLine("GET /things?x={x}&y={y}&z={z}")
CustomPageImpl<ThingDto> getElements(
    @Param("x") ZonedDateTime x,
    @Param("y") String y,
    @Param("z") String z,
    @QueryMap Pageable pageable);

By the way… Is there any simpler way to declare query parameters without having to refer four times to their names?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kdavisk6commented, Apr 29, 2020

Time is a friend here. I’ll revisit this.

1reaction
jebeaudetcommented, Apr 29, 2020

Just ran into this, IMO it should be clear in the documentation or even better, the Contract should throw an exception when it encounters such a case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feign Client does not resolve Query parameter - Stack Overflow
The OpenFeign @QueryMap annotation provides support for POJOs to be used as GET parameter maps. Spring Cloud OpenFeign provides an equivalent @ ...
Read more >
1. Declarative REST Client: Feign - Spring Cloud OpenFeign
The OpenFeign @QueryMap annotation provides support for POJOs to be used as GET parameter maps. Unfortunately, the default OpenFeign QueryMap annotation is ......
Read more >
QueryMap (Feign Core 10.9.1 API) - javadoc.io
A template parameter that can be applied to a Map that contains query parameters, ... It is not necessary to reference the parameter...
Read more >
PojoQueryBuilder (MarkLogic Java Client API 5.0.0)
It adds convenience methods specific to working with pojos and does not ... If you use PojoRepository to persist your products, you can...
Read more >
feign.RequestTemplate.queries java code examples - Tabnine
How to use. queries ... forEach(param -> parameters.add(param, "{" + param + "}")); } if ... queryMapIndex() == null, "Query map can only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found