Commit 99369f27 by Johannes Edmeier

Fix all RestTemplateBuilders

Fix the usage of RestTemplateBuilders which wasn't covered by PR #247
parent 46bd004e
......@@ -82,7 +82,7 @@ public class AdminServerWebConfiguration extends WebMvcConfigurerAdapter
private ResourcePatternResolver resourcePatternResolver;
@Autowired
private RestTemplateBuilder builder;
private RestTemplateBuilder restTemplBuilder;
@Bean
@ConditionalOnMissingBean
......@@ -181,7 +181,8 @@ public class AdminServerWebConfiguration extends WebMvcConfigurerAdapter
@Bean
@ConditionalOnMissingBean
public StatusUpdater statusUpdater() {
builder.messageConverters(new MappingJackson2HttpMessageConverter())
RestTemplateBuilder builder = restTemplBuilder
.messageConverters(new MappingJackson2HttpMessageConverter())
.errorHandler(new DefaultResponseErrorHandler() {
@Override
protected boolean hasError(HttpStatus statusCode) {
......
......@@ -39,7 +39,7 @@ public class SpringBootAdminClientAutoConfiguration {
private AdminProperties admin;
@Autowired
private RestTemplateBuilder builder;
private RestTemplateBuilder restTemplBuilder;
/**
* Task that registers the application at the spring-boot-admin application.
......@@ -47,7 +47,8 @@ public class SpringBootAdminClientAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ApplicationRegistrator registrator() {
builder = builder.messageConverters(new MappingJackson2HttpMessageConverter());
RestTemplateBuilder builder = restTemplBuilder
.messageConverters(new MappingJackson2HttpMessageConverter());
if (admin.getUsername() != null) {
builder = builder.basicAuthorization(admin.getUsername(), admin.getPassword());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment