I would like to be able to use custom value objects in my feign clients.

For example:

@FeignClient
public interface MyClient {

  @GetMapping("/users/{userId}")
  User getUser(@PathVariable UserId userId);
}

Note how the @PathVariable is typed to UserId, not to String.

I tried adding a org.springframework.core.convert.converter.Converter<UserId,String> in the application context that converts from UserId to String, but that was not used. The toString() method of UserId was still used instead.

Comment From: cbezmen

You can already archive this by adding to format registrar. @wimdeblauwe

@Bean
FeignFormatterRegistrar feignFormatterRegistrar() {
    return registry -> registry.addConverter(new UserIdConverter());
}

Comment From: cbezmen

@OlgaMaciaszek I think you can close this issue?