本文整理汇总了Java中com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature类的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Feature类属于com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module包,在下文中一共展示了Feature类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jacksonMessageConverter
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature; //导入依赖的package包/类
private MappingJackson2HttpMessageConverter jacksonMessageConverter() {
MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
ObjectMapper mapper = new ObjectMapper();
Hibernate4Module hibernate4Module = new Hibernate4Module();
hibernate4Module.configure(Feature.FORCE_LAZY_LOADING, true);
hibernate4Module.configure(Feature.USE_TRANSIENT_ANNOTATION, false);
mapper.registerModule(hibernate4Module);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
messageConverter.setObjectMapper(mapper);
return messageConverter;
}
示例2: jacksonMessageConverter
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature; //导入依赖的package包/类
private MappingJackson2HttpMessageConverter jacksonMessageConverter() {
MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
ObjectMapper mapper = new ObjectMapper();
Hibernate4Module hibernate4Module = new Hibernate4Module();
hibernate4Module.configure(Feature.FORCE_LAZY_LOADING, true);
mapper.registerModule(hibernate4Module);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
mapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
messageConverter.setObjectMapper(mapper);
return messageConverter;
}
示例3: init
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature; //导入依赖的package包/类
@Override
public void init() {
super.init();
Hibernate4Module module = new Hibernate4Module();
module.configure(Feature.FORCE_LAZY_LOADING, true);
getObjectMapper().registerModule(module);
}