Describe the bug
The following endpoint should resolve to the balances/AAA/2022-11-1 url
@RequestMapping(
method = RequestMethod.POST,
value = "/balances/{assetId}/{valueDate}"
)
List<ValueDateBalance> getBalances(@PathVariable String assetId, @PathVariable LocalDate valueDate);
Instead it resolves to balances/AAA/11/1/22
Use @DateTimeFormat(iso = DATE) workaround the issue
Version 3.1.4
Comment From: OlgaMaciaszek
Hello, @rotilho. Please provide the valueDate String that is passed as the argument to the getBalances method.
Comment From: rotilho
Hello Olga! I updated the example. I had copied one of my attempts to workaround it instead of the sample.
Comment From: OlgaMaciaszek
@rotilho Actually, in this case, preceding the LocalDate argument in Feign Client with @DateTimeFormat should be a good solution to get Spring to automatically convert to the desired format, like so:
@RequestMapping(
method = RequestMethod.POST,
value = "/balances/{assetId}/{valueDate}"
)
List<ValueDateBalance> getBalances(@PathVariable String assetId, @PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate valueDate);
Is there any reason why this would not be a good solution in your scenario?
Comment From: rotilho
I was under the impression that spring-cloud-openfeign was trying to mimic how spring controller works. Currently, the @DateTimeFormat is not required anymore in the controllers so I was expecting the same would/should happen to openfeign.
Comment From: OlgaMaciaszek
It does not work exactly same. Various options are only available on server side and vice versa. It's just close enough that it's very easy implement if someone knows the Spring MVC server-side functionality, so I would consider it as an enhancement rather than a bug. Since Spring Cloud OpenFeign has been announced as feature-complete as of 2022.0.0 in favour of Spring Interface Clients. We're not planning on adding on any major features at this point. Instead, we'll be concentrating on providing more features around the new solution. I'm going to mark it as enhancement and help wanted though. If someone submits a PR with this change, we'll review it.
Comment From: rotilho
I understand. Thank for the explanation, I'll take a look in the Interface Clients.