https://kotlinlang.org logo
#spring
Title
a

Alfy

03/03/2022, 3:21 PM
Anyone know how to retrieve the spring provided instance of an object mapper? I've tried autowiring as such
Copy code
@Autowired
lateinit var builder: Jackson2ObjectMapperBuilder
😶 1
t

Thomas

03/03/2022, 3:25 PM
objectMapper: ObjectMapper works for me (in the Java world though)
a

Alfy

03/03/2022, 3:28 PM
I've tried that as well
Copy code
@Autowired
private val objectMapper: ObjectMapper
but no luck lol
t

Tom Hermann

03/03/2022, 6:30 PM
You should be able to inject an instance of the
ObjectMapper
or
Jackson2ObjectMapperBuilder
. See: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/sprin[…]mework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java If you manually registered a qualified instance or don’t have right starter project (web/webflux) in your project, that may be the cause of this behavior.
1
8 Views