Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-boot-admin
Commits
447379a5
Commit
447379a5
authored
Sep 14, 2015
by
Johannes Stelzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not handle 5xx or 4xx responses in RestTemplate for the StatusUpdater as error
fixes #105
parent
3cb0378f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
AdminServerWebConfiguration.java
...entric/boot/admin/config/AdminServerWebConfiguration.java
+9
-2
StatusUpdaterTest.java
...de/codecentric/boot/admin/registry/StatusUpdaterTest.java
+1
-1
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/config/AdminServerWebConfiguration.java
View file @
447379a5
...
@@ -26,10 +26,12 @@ import org.springframework.context.ApplicationListener;
...
@@ -26,10 +26,12 @@ import org.springframework.context.ApplicationListener;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
;
import
org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
import
org.springframework.scheduling.config.ScheduledTaskRegistrar
;
import
org.springframework.web.client.DefaultResponseErrorHandler
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
...
@@ -114,8 +116,13 @@ public class AdminServerWebConfiguration extends WebMvcConfigurerAdapter impleme
...
@@ -114,8 +116,13 @@ public class AdminServerWebConfiguration extends WebMvcConfigurerAdapter impleme
@ConfigurationProperties
(
"spring.boot.admin.monitor"
)
@ConfigurationProperties
(
"spring.boot.admin.monitor"
)
public
StatusUpdater
statusUpdater
(
ApplicationStore
store
)
{
public
StatusUpdater
statusUpdater
(
ApplicationStore
store
)
{
RestTemplate
template
=
new
RestTemplate
();
RestTemplate
template
=
new
RestTemplate
();
template
.
getMessageConverters
().
add
(
template
.
getMessageConverters
().
add
(
new
MappingJackson2HttpMessageConverter
());
new
MappingJackson2HttpMessageConverter
());
template
.
setErrorHandler
(
new
DefaultResponseErrorHandler
()
{
@Override
protected
boolean
hasError
(
HttpStatus
statusCode
)
{
return
false
;
}
});
return
new
StatusUpdater
(
template
,
store
);
return
new
StatusUpdater
(
template
,
store
);
}
}
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/registry/StatusUpdaterTest.java
View file @
447379a5
...
@@ -84,7 +84,7 @@ public class StatusUpdaterTest {
...
@@ -84,7 +84,7 @@ public class StatusUpdaterTest {
// HTTP != 200 - DOWN
// HTTP != 200 - DOWN
when
(
template
.
getForEntity
(
"health"
,
Map
.
class
)).
thenReturn
(
when
(
template
.
getForEntity
(
"health"
,
Map
.
class
)).
thenReturn
(
ResponseEntity
.
status
(
50
0
).<
Map
>
body
(
null
));
ResponseEntity
.
status
(
50
3
).<
Map
>
body
(
null
));
updater
.
updateStatus
(
Application
.
create
(
"foo"
).
withId
(
"id"
)
updater
.
updateStatus
(
Application
.
create
(
"foo"
).
withId
(
"id"
)
.
withHealthUrl
(
"health"
).
build
());
.
withHealthUrl
(
"health"
).
build
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment