File tree Expand file tree Collapse file tree
runtime/src/test/groovy/io/micronaut/jackson Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,26 @@ class JacksonSetupSpec extends Specification {
6969 applicationContext?. close()
7070 }
7171
72+ void " verify that the defaultTyping configuration option is correctly converted and set on the object mapper" () {
73+ given :
74+ ApplicationContext applicationContext = new DefaultApplicationContext (" test" )
75+ applicationContext. environment. addPropertySource(MapPropertySource . of(
76+ ' jackson.dateFormat' : ' yyMMdd' ,
77+ ' jackson.defaultTyping' : ' NON_FINAL'
78+ ))
79+ applicationContext. start()
80+
81+ expect :
82+ applicationContext. containsBean(ObjectMapper . class)
83+ ((ObjectMapper.DefaultTypeResolverBuilder ) applicationContext. getBean(ObjectMapper . class). deserializationConfig. getDefaultTyper(null )). _appliesFor == ObjectMapper.DefaultTyping . NON_FINAL
84+
85+ applicationContext. containsBean(JacksonConfiguration )
86+ applicationContext. getBean(JacksonConfiguration ). defaultTyping == ObjectMapper.DefaultTyping . NON_FINAL
87+
88+ cleanup :
89+ applicationContext?. close()
90+ }
91+
7292 @Unroll
7393 void ' Configuring #configuredJackonPropertyNamingStrategy sets PropertyNamingStrategy on the Context ObjectMapper.' () {
7494 when :
You can’t perform that action at this time.
0 commit comments