1 package top.infra.jackson2;
2
3 import static java.lang.Boolean.FALSE;
4
5 import com.fasterxml.jackson.annotation.JsonInclude;
6 import com.fasterxml.jackson.core.JsonGenerator;
7 import com.fasterxml.jackson.core.JsonParser;
8 import com.fasterxml.jackson.databind.DeserializationFeature;
9 import com.fasterxml.jackson.databind.MapperFeature;
10 import com.fasterxml.jackson.databind.SerializationFeature;
11
12 import lombok.Data;
13 import lombok.Getter;
14 import lombok.Setter;
15
16 import org.springframework.boot.context.properties.ConfigurationProperties;
17 import org.springframework.boot.context.properties.NestedConfigurationProperty;
18
19 import java.util.HashMap;
20 import java.util.Locale;
21 import java.util.Map;
22 import java.util.TimeZone;
23
24
25
26
27 @ConfigurationProperties(prefix = "spring.jackson")
28 @Getter
29 @Setter
30 public class Jackson2Properties {
31
32
33
34
35
36 private String dateFormat;
37
38
39
40
41
42 private String jodaDateTimeFormat;
43
44
45
46
47
48
49 private String propertyNamingStrategy;
50
51
52
53
54 private Map<SerializationFeature, Boolean> serialization = new HashMap<SerializationFeature, Boolean>();
55
56
57
58
59 private Map<DeserializationFeature, Boolean> deserialization = new HashMap<DeserializationFeature, Boolean>();
60
61
62
63
64 private Map<MapperFeature, Boolean> mapper = new HashMap<MapperFeature, Boolean>();
65
66
67
68
69 private Map<JsonParser.Feature, Boolean> parser = new HashMap<JsonParser.Feature, Boolean>();
70
71
72
73
74 private Map<JsonGenerator.Feature, Boolean> generator = new HashMap<JsonGenerator.Feature, Boolean>();
75
76
77
78
79
80 private JsonInclude.Include defaultPropertyInclusion;
81
82
83
84
85
86 private TimeZone timeZone = null;
87
88
89
90
91 private Locale locale;
92 @NestedConfigurationProperty
93 private Jaxb jaxb = new Jaxb();
94
95 @Data
96 public static class Jaxb {
97
98 private Boolean enabled = FALSE;
99 }
100 }