An example demonstrating printing of tenant id as mdc in logs.
- We are manually serializing the object
- We want to serialize a particular type of field (eg. LocalDateTime type) in a custom way
- Modifying the ObjectMapper instance to create modules defining serializers for particular type and registering those modules in the ObjectMapper.
- A third party library is responsible for serializing or deserializing the object eg. custom serialization of api response contracts in a spring webapplication. i.e the ObjectMapper cannot be accessed and configured directly
- We want to serialize instances of only one class.
- Using @JsonSerialize at class level to register a custom serializer for instances of that class.
- The object to be serialized/deserialized has a Map field whose key is another object that Jackson can't serialize or deserialize implicitly
- A third party library is responsible for serializing or deserializing the object eg. custom serialization of api response contracts in a spring webapplication. i.e the ObjectMapper cannot be accessed and configured directly
- Using @JsonSerialize before Map field to register a custom serializer for the key.
To access the api in this example, first we have to procure the Auth Token (using one of the OAuth2 Flows) containing a scope "canGreet".
Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.
This gist describes the configuration required for Spring reactive WebClient to make a call to an OAuth2 protected resource through OAuth2.0 Client Credentials Grant Type Flow.
Assumption is that the Authorization Server supports OpenId Connect 1.0 specifications.
NewerOlder