Commit 7077809
committed
Configure Kotlin JSON converters as Jackson alternative
Prior to this commit, Spring MVC and WebFlux would consider the
"kotlinx.serialization" JSON codecs and converters in addition to other
JSON alternatives like Jackson, Gson and Jsonb.
This would cause issues because while in most cases this library is only
involved if the type is annotated with "@serializable", this is not true
for Java enums. In this particular case, the codec shadows Jackson and
causes issues.
This commit now considers kotlinx.serialization JSON support as an
alternative to Jackson. Just like Jsonb and GSON, this is only
auto-detected if Jackson is not present.
We received consistent feedback that kotlinx.serialization is popular in
Kotlin libraries and is often a transitive dependency. As a result, we
cannot consider its presence on the classpath as a strong enough signal
to configure it by default.
Closes gh-344101 parent 6ded25b commit 7077809
File tree
8 files changed
+30
-41
lines changed- framework-docs/modules/ROOT/pages/web/webmvc
- spring-webflux/src/test/java/org/springframework/web/reactive/config
- spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation
- spring-web/src
- main/java/org/springframework/http/codec/support
- test/java/org/springframework/http/codec/support
8 files changed
+30
-41
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | 578 | | |
582 | 579 | | |
583 | 580 | | |
| |||
587 | 584 | | |
588 | 585 | | |
589 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | 716 | | |
720 | 717 | | |
721 | 718 | | |
| |||
724 | 721 | | |
725 | 722 | | |
726 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
| |||
Lines changed: 6 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
| |||
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
97 | | - | |
| 95 | + | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
| |||
108 | 106 | | |
109 | 107 | | |
110 | 108 | | |
111 | | - | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
| |||
120 | 117 | | |
121 | 118 | | |
122 | 119 | | |
123 | | - | |
| 120 | + | |
124 | 121 | | |
125 | 122 | | |
126 | 123 | | |
| |||
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
136 | 132 | | |
137 | 133 | | |
138 | 134 | | |
| |||
188 | 184 | | |
189 | 185 | | |
190 | 186 | | |
191 | | - | |
| 187 | + | |
192 | 188 | | |
193 | 189 | | |
194 | 190 | | |
| |||
201 | 197 | | |
202 | 198 | | |
203 | 199 | | |
204 | | - | |
205 | 200 | | |
206 | 201 | | |
207 | 202 | | |
| |||
250 | 245 | | |
251 | 246 | | |
252 | 247 | | |
253 | | - | |
| 248 | + | |
254 | 249 | | |
255 | 250 | | |
256 | 251 | | |
| |||
260 | 255 | | |
261 | 256 | | |
262 | 257 | | |
263 | | - | |
| 258 | + | |
264 | 259 | | |
265 | 260 | | |
266 | 261 | | |
| |||
274 | 269 | | |
275 | 270 | | |
276 | 271 | | |
277 | | - | |
| 272 | + | |
278 | 273 | | |
279 | 274 | | |
280 | 275 | | |
| |||
Lines changed: 4 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | | - | |
| 91 | + | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
| |||
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
106 | | - | |
107 | 104 | | |
108 | 105 | | |
109 | 106 | | |
| |||
114 | 111 | | |
115 | 112 | | |
116 | 113 | | |
117 | | - | |
| 114 | + | |
118 | 115 | | |
119 | 116 | | |
120 | 117 | | |
| |||
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | | - | |
130 | 126 | | |
131 | 127 | | |
132 | 128 | | |
| |||
156 | 152 | | |
157 | 153 | | |
158 | 154 | | |
159 | | - | |
| 155 | + | |
160 | 156 | | |
161 | 157 | | |
162 | 158 | | |
| |||
173 | 169 | | |
174 | 170 | | |
175 | 171 | | |
176 | | - | |
177 | 172 | | |
178 | 173 | | |
179 | 174 | | |
| |||
203 | 198 | | |
204 | 199 | | |
205 | 200 | | |
206 | | - | |
| 201 | + | |
207 | 202 | | |
208 | 203 | | |
209 | 204 | | |
| |||
219 | 214 | | |
220 | 215 | | |
221 | 216 | | |
222 | | - | |
223 | 217 | | |
224 | 218 | | |
225 | 219 | | |
| |||
Lines changed: 2 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
92 | 90 | | |
93 | 91 | | |
94 | 92 | | |
95 | | - | |
| 93 | + | |
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
| |||
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
108 | | - | |
109 | 106 | | |
110 | 107 | | |
111 | 108 | | |
| |||
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
119 | | - | |
| 116 | + | |
120 | 117 | | |
121 | 118 | | |
122 | 119 | | |
| |||
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
131 | | - | |
132 | 128 | | |
133 | 129 | | |
134 | 130 | | |
| |||
176 | 172 | | |
177 | 173 | | |
178 | 174 | | |
179 | | - | |
180 | 175 | | |
181 | 176 | | |
182 | 177 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | 897 | | |
901 | 898 | | |
902 | 899 | | |
| |||
914 | 911 | | |
915 | 912 | | |
916 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
917 | 917 | | |
918 | 918 | | |
919 | 919 | | |
| |||
0 commit comments