I have dived into the documentation, but only find circular references to the mechanical aspects of the use of webCleint
, without any concrete examples… And nothing that merges it with the use of @JsonView
.
I have a microservice that accepts a DTO from the client, performs basic validation, then wants to pass it on to another microservice. But, in passing it on, I want to strip out fields, per a JsonView.
Basic User DTO
@JsonView({Views.Incoming.class,Views.Internal.class})
private String email;
@JsonView({Views.Incoming.class,Views.Internal.class})
private String password;
@JsonView(Views.Incoming.class)
private String passwordCheck //validated as matching in first service, not needed when handed off.
How do I a) actually build a webClient
, make a request with it, and return a usable result, and b) give it my DTO filtered by @JsonView(Views.Internal.class)
?
(The documentation about webClient
itself is confusing, in that it suggests that a separate one is needed for each request (differentiating it from restTemplate
), but the examples I have found instantiate one as static in the sercive class…)