本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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);
}
示例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());
}
示例9: restTemplate
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
示例10: restTemplate
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
示例11: FlightServiceAdapter
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
public FlightServiceAdapter(RestTemplateBuilder restTemplateBuilder) {
this.template = restTemplateBuilder.build();
}
示例12: restTemplateFoo
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
@Qualifier("foo")
public RestTemplate restTemplateFoo(RestTemplateBuilder builder) {
return builder.build();
}
示例13: restTemplate
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.build();
}
示例14: restTemplate
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.build();
}
示例15: restTemplate
import org.springframework.boot.web.client.RestTemplateBuilder; //导入方法依赖的package包/类
@Bean
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder.build();
}