Affects: 6.0.0-M5
@DateTimeFormat
is not formatting the path variable in the final URL.
example client:
public interface OpenBankingClient {
@GetExchange("/periods/{token}/{dateFrom}/{dateTo}/transactions.json")
OpenBankingTransactionsDto fetchTransactionsStatement(
@PathVariable String token,
@PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate dateFrom,
@PathVariable @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate dateTo);
}
client config:
@Configuration
public class RestClientConfig {
@Bean
public OpenBankingClient openBankingClient() throws Exception {
WebClientAdapter webClientAdapter =
WebClientAdapter.forClient(WebClient.create("https://example.com"));
HttpServiceProxyFactory httpServiceProxyFactory = new HttpServiceProxyFactory(webClientAdapter);
httpServiceProxyFactory.afterPropertiesSet();
return httpServiceProxyFactory.createClient(OpenBankingClient.class);
}
}
The desired string format of dateTo
and dateFrom
variables is yyyy-MM-dd
.
-- for example, https://example.com/periods/xxx/2022-09-05/2022-09-06/transactions.json
What am I getting is MM/dd/yy
(this may vary based on the locale) -- for example, https://example.com/periods/xxx/9%2F5%2F22/9%2F6%2F22/transactions.json