@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @Component public @interface JsonComponent
@Component
that provides JsonSerializer
,
JsonDeserializer
or KeyDeserializer
implementations to be registered
with Jackson when JsonComponentModule
is in use. Can be used to annotate
implementations directly or a class that contains them as inner-classes. For example:
@JsonComponent public class CustomerJsonComponent { public static class Serializer extends JsonSerializer<Customer> { // ... } public static class Deserializer extends JsonDeserializer<Customer> { // ... } }
JsonComponentModule
Modifier and Type | Optional Element and Description |
---|---|
JsonComponent.Scope |
scope
The scope under which the serializer/deserializer should be registered with the
module.
|
Class<?>[] |
type
The types that are handled by the provided serializer/deserializer.
|
String |
value
The value may indicate a suggestion for a logical component name, to be turned into
a Spring bean in case of an autodetected component.
|
@AliasFor(annotation=org.springframework.stereotype.Component.class) public abstract String value
public abstract Class<?>[] type
KeyDeserializer
, as the type cannot be inferred. For a
JsonSerializer
or JsonDeserializer
it can be used to limit handling
to a subclasses of type inferred from the generic.public abstract JsonComponent.Scope scope
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.