本文整理汇总了Java中org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.setObjectMapper方法的典型用法代码示例。如果您正苦于以下问题:Java MappingJackson2HttpMessageConverter.setObjectMapper方法的具体用法?Java MappingJackson2HttpMessageConverter.setObjectMapper怎么用?Java MappingJackson2HttpMessageConverter.setObjectMapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
的用法示例。
在下文中一共展示了MappingJackson2HttpMessageConverter.setObjectMapper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRestTemplate
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
protected RestTemplate getRestTemplate() {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.registerModule(new Jackson2HalModule());
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
converter.setObjectMapper(mapper);
return new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(converter));
}
示例2: jacksonMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
private MappingJackson2HttpMessageConverter jacksonMessageConverter() {
MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Hibernate4Module().enable(Hibernate4Module.Feature.USE_TRANSIENT_ANNOTATION));
messageConverter.setObjectMapper(mapper);
return messageConverter;
}
示例3: init
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Before
public void init() {
final MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
messageConverter.setObjectMapper(new JacksonConfig().objectMapper());
final TenantRegistry tenantRegistry = new InMemoryTenantRegistry();
final TenantController tenantController = new TenantController(tenantRegistry);
final DataSourceController dataSourceController = new DataSourceController(tenantRegistry);
final SchemaController schemaController = new SchemaController(tenantRegistry);
final TableController tableController = new TableController(tenantRegistry);
final ColumnController columnController = new ColumnController(tenantRegistry);
final QueryController queryController = new QueryController(tenantRegistry);
final TableDataController tableDataController = new TableDataController(tenantRegistry);
mockMvc = MockMvcBuilders.standaloneSetup(tenantController, dataSourceController, schemaController,
tableController, columnController, queryController, tableDataController).setMessageConverters(
messageConverter).build();
}
示例4: createRestTemplate
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public RestTemplate createRestTemplate() {
RestTemplate restTemplate = new RestTemplate();
List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
MappingJackson2HttpMessageConverter jsonMessageConverter = new MappingJackson2HttpMessageConverter();
jsonMessageConverter.setObjectMapper(objectMapper);
messageConverters.add(jsonMessageConverter);
restTemplate.setMessageConverters(messageConverters);
return restTemplate;
}
开发者ID:berndruecker,项目名称:camunda-spring-boot-amqp-microservice-cloud-example,代码行数:11,代码来源:RestConfiguration.java
示例5: JsonDataProviderConnector
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
public JsonDataProviderConnector(final Class<T> dtoType) {
this.dtoType = dtoType;
final ObjectMapper objectMapper = createObjectMapper();
final MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter = new MappingJackson2HttpMessageConverter();
mappingJacksonHttpMessageConverter.setObjectMapper(objectMapper);
// create message converters list
httpMessageConverters = new ArrayList<>();
httpMessageConverters.add(mappingJacksonHttpMessageConverter);
}
示例6: createConverters
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
private static List<HttpMessageConverter<?>> createConverters() {
List<HttpMessageConverter<?>> converters = new ArrayList<>();
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converters.add(new StringHttpMessageConverter());
converters.add(converter);
converter.setObjectMapper(ParserUtil.getJsonParser());
return converters;
}
示例7: customConverters
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public HttpMessageConverters customConverters() {
MappingJackson2HttpMessageConverter jsonConverter =
new MappingJackson2HttpMessageConverter();
jsonConverter.setSupportedMediaTypes(Arrays.asList(
new MediaType("application", "json"),
new MediaType("text", "json")
));
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JsonOrgModule());
jsonConverter.setObjectMapper(objectMapper);
return new HttpMessageConverters(jsonConverter);
}
示例8: jackson2HttpMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter jackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
Jackson2ObjectMapperBuilder builder = this.jacksonBuilder();
converter.setObjectMapper(builder.build());
return converter;
}
示例9: configureMessageConverters
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.registerModule(new JavaTimeModule());
converter.setObjectMapper(objectMapper);
converters.add(converter);
super.configureMessageConverters(converters);
}
示例10: jacksonMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter jacksonMessageConverter() {
MappingJackson2HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter();
jacksonConverter.setSupportedMediaTypes(Arrays.asList(MediaType.valueOf("application/json")));
jacksonConverter.setObjectMapper(jacksonObjectMapper());
return jacksonConverter;
}
示例11: mappingJackson2HttpMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
jsonConverter.setSupportedMediaTypes(MediaType.parseMediaTypes("application/hal+json"));
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
objectMapper.registerModule(new Jackson2HalModule());
jsonConverter.setObjectMapper(objectMapper);
return jsonConverter;
}
示例12: jsonConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter jsonConverter() {
Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.xml();
builder.indentOutput(true);
MappingJackson2HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter(builder.build());
jacksonConverter.setSupportedMediaTypes(Arrays.asList(MediaType.valueOf("application/json")));
jacksonConverter.setObjectMapper(jacksonObjectMapper());
return jacksonConverter;
}
示例13: getJsonMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Override
protected MappingJackson2HttpMessageConverter getJsonMessageConverter() {
MappingJackson2HttpMessageConverter converter = super.getJsonMessageConverter();
converter.setObjectMapper(new ObjectMapper().registerModule(new TwitterModule()));
return converter;
}
示例14: mappingJackson2HttpMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
messageConverter.setObjectMapper(objectMapper);
return messageConverter;
}
示例15: jackson2HttpMessageConverter
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
private MappingJackson2HttpMessageConverter jackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
Jackson2ObjectMapperBuilder builder = this.jacksonBuilder();
converter.setObjectMapper(builder.build());
return converter;
}