当前位置: 首页>>代码示例>>Java>>正文


Java MappingJackson2HttpMessageConverter.setObjectMapper方法代码示例

本文整理汇总了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));
}
 
开发者ID:ewolff,项目名称:microservice-cloudfoundry,代码行数:12,代码来源:CatalogClient.java

示例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;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:8,代码来源:CloudUnitApplicationContext.java

示例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();
}
 
开发者ID:apache,项目名称:metamodel-membrane,代码行数:19,代码来源:TenantInteractionScenarioTest.java

示例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);
}
 
开发者ID:ad-tech-group,项目名称:openssp,代码行数:12,代码来源:JsonDataProviderConnector.java

示例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;
}
 
开发者ID:notifye,项目名称:botengine-ai,代码行数:9,代码来源:HttpClient.java

示例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);
}
 
开发者ID:chaokunyang,项目名称:jkes,代码行数:15,代码来源:WebConfig.java

示例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;
}
 
开发者ID:lord-of-code,项目名称:loc-framework,代码行数:8,代码来源:LocAccessLogTest.java

示例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);
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:13,代码来源:WebConfig.java

示例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;
}
 
开发者ID:simplymequeeny,项目名称:dynamodb-client-web-gui,代码行数:8,代码来源:WebAppConfig.java

示例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;
}
 
开发者ID:xiaojieliu7,项目名称:MicroServiceProject,代码行数:12,代码来源:Application.java

示例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;
}
 
开发者ID:vadivelmurugesan,项目名称:spring-batch-admin,代码行数:10,代码来源:WebConfig.java

示例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;
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:7,代码来源:TwitterTemplate.java

示例14: mappingJackson2HttpMessageConverter

import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; //导入方法依赖的package包/类
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
    MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
    messageConverter.setObjectMapper(objectMapper);
    return messageConverter;
}
 
开发者ID:DomKing,项目名称:busi-support,代码行数:7,代码来源:MessageConverterConfig.java

示例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;
}
 
开发者ID:Devskiller,项目名称:friendly-id,代码行数:7,代码来源:MvcTest.java


注:本文中的org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.setObjectMapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。