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


Java RestTemplateBuilder.build方法代码示例

本文整理汇总了Java中org.springframework.boot.web.client.RestTemplateBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java RestTemplateBuilder.build方法的具体用法?Java RestTemplateBuilder.build怎么用?Java RestTemplateBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.web.client.RestTemplateBuilder的用法示例。


在下文中一共展示了RestTemplateBuilder.build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ProjectGenerationStatPublisher

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
public ProjectGenerationStatPublisher(ProjectRequestDocumentFactory documentFactory,
		StatsProperties statsProperties, RestTemplateBuilder restTemplateBuilder,
		RetryTemplate retryTemplate) {
	this.documentFactory = documentFactory;
	this.statsProperties = statsProperties;
	this.objectMapper = createObjectMapper();
	StatsProperties.Elastic elastic = statsProperties.getElastic();
	if (StringUtils.hasText(elastic.getUsername())) {
		this.restTemplate = restTemplateBuilder
				.basicAuthorization(elastic.getUsername(),
						elastic.getPassword())
				.build();
	} else {
		this.restTemplate = restTemplateBuilder.build();
	}
	this.retryTemplate = retryTemplate;
}
 
开发者ID:spring-io,项目名称:initializr,代码行数:18,代码来源:ProjectGenerationStatPublisher.java

示例2: proxyExchangeArgumentResolver

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ProxyExchangeArgumentResolver proxyExchangeArgumentResolver(
		Optional<RestTemplateBuilder> optional, ProxyProperties proxy) {
	RestTemplateBuilder builder = optional.orElse(new RestTemplateBuilder());
	RestTemplate template = builder.build();
	template.setErrorHandler(new NoOpResponseErrorHandler());
	template.getMessageConverters().add(new ByteArrayHttpMessageConverter() {
		@Override
		public boolean supports(Class<?> clazz) {
			return true;
		}
	});
	ProxyExchangeArgumentResolver resolver = new ProxyExchangeArgumentResolver(
			template);
	resolver.setHeaders(proxy.convertHeaders());
	resolver.setSensitive(proxy.getSensitive()); // can be null
	return resolver;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-gateway,代码行数:20,代码来源:ProxyResponseAutoConfiguration.java

示例3: createRestTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
private RestTemplate createRestTemplate(JiraConnectionProperties jiraConnectionProperties) {
	RestTemplateBuilder builder = restTemplateBuilder.errorHandler(new JiraRestResponseErrorHandler(url));
	BasicAuthentication basicAuth = jiraConnectionProperties.getBasicAuth();
	if (basicAuth != null) {
		builder = builder.basicAuthorization(basicAuth.getUsername(), basicAuth.getPassword());
	}

	if (jiraConnectionProperties.getSslTrustStore() != null) {
		builder = builder.requestFactory(new HttpComponentsClientHttpRequestFactory(httpClient(jiraConnectionProperties)));
	}

	return builder.build();
}
 
开发者ID:cronn-de,项目名称:jira-sync,代码行数:14,代码来源:JiraServiceRestClient.java

示例4: restTemplateOne

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplateOne(RestTemplateBuilder builder) {
	try {
		return builder.build();
	}
	finally {
		breakBuilderOnNextCall(builder);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:WebClientAutoConfigurationTests.java

示例5: restTemplateTwo

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplateTwo(RestTemplateBuilder builder) {
	try {
		return builder.build();
	}
	finally {
		breakBuilderOnNextCall(builder);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:WebClientAutoConfigurationTests.java

示例6: setApplicationContext

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext)
		throws BeansException {
	RestTemplateBuilder builder = getRestTemplateBuilder(applicationContext);
	TestRestTemplate template = new TestRestTemplate(builder.build());
	template.setUriTemplateHandler(
			new LocalHostUriTemplateHandler(applicationContext.getEnvironment()));
	this.object = template;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:SpringBootTestContextCustomizer.java

示例7: registrator

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ApplicationRegistrator registrator(ClientProperties client,
                                          ApplicationFactory applicationFactory,
                                          RestTemplateBuilder restTemplBuilder) {
    RestTemplateBuilder builder = restTemplBuilder.messageConverters(new MappingJackson2HttpMessageConverter())
                                                  .requestFactory(SimpleClientHttpRequestFactory.class)
                                                  .setConnectTimeout((int) client.getConnectTimeout().toMillis())
                                                  .setReadTimeout((int) client.getReadTimeout().toMillis());
    if (client.getUsername() != null) {
        builder = builder.basicAuthorization(client.getUsername(), client.getPassword());
    }
    return new ApplicationRegistrator(builder.build(), client, applicationFactory);
}
 
开发者ID:codecentric,项目名称:spring-boot-admin,代码行数:15,代码来源:SpringBootAdminClientAutoConfiguration.java

示例8: initializrMetadataProvider

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean(InitializrMetadataProvider.class)
public InitializrMetadataProvider initializrMetadataProvider(
		InitializrProperties properties,
		ObjectMapper objectMapper,
		RestTemplateBuilder restTemplateBuilder) {
	InitializrMetadata metadata = InitializrMetadataBuilder
			.fromInitializrProperties(properties).build();
	return new DefaultInitializrMetadataProvider(metadata,
			objectMapper, restTemplateBuilder.build());
}
 
开发者ID:spring-io,项目名称:initializr,代码行数:12,代码来源:InitializrAutoConfiguration.java

示例9: restTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
  return builder.build();
}
 
开发者ID:shelajev,项目名称:concurrency-demo,代码行数:5,代码来源:ConcurrencyDemoApplication.java

示例10: restTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
    return builder.build();
}
 
开发者ID:Paleozoic,项目名称:spring_cloud_demo,代码行数:5,代码来源:RestConfig.java

示例11: FlightServiceAdapter

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
public FlightServiceAdapter(RestTemplateBuilder restTemplateBuilder) {
    this.template = restTemplateBuilder.build();
}
 
开发者ID:cr0wned0ne,项目名称:eflightservice-wi20162,代码行数:4,代码来源:FlightServiceAdapter.java

示例12: restTemplateFoo

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
@Qualifier("foo")
public RestTemplate restTemplateFoo(RestTemplateBuilder builder) {
    return builder.build();
}
 
开发者ID:opentracing-contrib,项目名称:java-spring-web,代码行数:6,代码来源:RestTemplateAutoConfigurationTest.java

示例13: restTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
  return restTemplateBuilder.build();
}
 
开发者ID:opentracing-contrib,项目名称:java-spring-cloud,代码行数:5,代码来源:MockTracingConfiguration.java

示例14: restTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
	return restTemplateBuilder.build();
}
 
开发者ID:objectiser,项目名称:opentracing-prometheus-example,代码行数:5,代码来源:OrderMgrApplication.java

示例15: restTemplate

import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
    return restTemplateBuilder.build();
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:5,代码来源:MetricsAutoConfigurationTest.java


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