java无法向Jackson ObjectMapper类注册模块
我想使用JacksonObjectMapper类注册Jdk8Module、JavaTimeModule、GuavaModule和JsonOrgModule模块。我的意见如下:
ObjectMapper objectmapper = new ObjectMapper()
.registerModules(new AfterburnerModule(),
new Jdk8Module(), new JavaTimeModule(), new GuavaModule(),
new JsonOrgModule());
但我有以下错误:
The method registerModules(Module...) in the type ObjectMapper is not applicable for the arguments (AfterburnerModule, Jdk8Module, JavaTimeModule, GuavaModule, JsonOrgModule)
# 1 楼答案
为杰克逊1。x、 从
org.codehaus.jackson.map
导入ObjectMapper
和Module
为杰克逊2。x、 从
com.fasterxml.jackson.databind
导入ObjectMapper
和Module