當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。