我有一个使用以下方法的会话Bean:@POST@Consumes("application/x-www-form-urlencoded")@Path("/calculate")@Produces("application/json")public CalculationResult calculate(@FormParam("childProfile") String childProfile, @FormParam("parentProfile") String parentProfile) {...}返回的CalculationResult无法映射到JSON,并且发生以下异常:Caused by: com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class com.test.UniqueName and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)...如何SerializationFeature在Wildfly中配置Jackson及其及其?
2 回答
慕斯王
TA贡献1864条经验 获得超2个赞
野蝇9
pom.xml
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.8.Final</version>
<scope>provided</scope>
</dependency>
Java类
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
public class SomePojo implements Serializable {
}
添加回答
举报
0/150
提交
取消