Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
1acffdf6
Commit
1acffdf6
authored
May 08, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
f3a40e03
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
25 deletions
+32
-25
EndpointAutoConfiguration.java
...boot/actuate/autoconfigure/EndpointAutoConfiguration.java
+1
-1
HealthIndicatorAutoConfiguration.java
...tuate/autoconfigure/HealthIndicatorAutoConfiguration.java
+8
-5
HealthEndpoint.java
...springframework/boot/actuate/endpoint/HealthEndpoint.java
+4
-4
MongoHealthIndicator.java
...ngframework/boot/actuate/health/MongoHealthIndicator.java
+4
-2
RedisHealthIndicator.java
...ngframework/boot/actuate/health/RedisHealthIndicator.java
+4
-2
EndpointAutoConfigurationTests.java
...actuate/autoconfigure/EndpointAutoConfigurationTests.java
+1
-1
HealthIndicatorAutoConfigurationTests.java
.../autoconfigure/HealthIndicatorAutoConfigurationTests.java
+5
-5
HealthEndpointTests.java
...gframework/boot/actuate/endpoint/HealthEndpointTests.java
+1
-1
MongoHealthIndicatorTests.java
...mework/boot/actuate/health/MongoHealthIndicatorTests.java
+2
-2
RedisHealthIndicatorTests.java
...mework/boot/actuate/health/RedisHealthIndicatorTests.java
+2
-2
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java
View file @
1acffdf6
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -28,6 +28,7 @@ import org.springframework.boot.actuate.health.RedisHealthIndicator;
import
org.springframework.boot.actuate.health.SimpleDataSourceHealthIndicator
;
import
org.springframework.boot.actuate.health.VanillaHealthIndicator
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.jdbc.CommonsDataSourceConfiguration
;
...
...
@@ -44,6 +45,8 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link HealthIndicator}s.
*
* @author Christian Dupuis
* @since 1.1.0
*/
...
...
@@ -72,14 +75,14 @@ public class HealthIndicatorAutoConfiguration {
@ConditionalOnMissingBean
(
name
=
"dbHealthIndicator"
)
public
HealthIndicator
<?
extends
Object
>
dbHealthIndicator
()
{
if
(
this
.
dataSources
.
size
()
==
1
)
{
return
new
SimpleDataSourceHealthIndicator
(
this
.
dataSources
.
values
()
.
iterator
()
.
next
());
return
new
SimpleDataSourceHealthIndicator
(
this
.
dataSources
.
values
()
.
iterator
().
next
());
}
CompositeHealthIndicator
composite
=
new
CompositeHealthIndicator
();
for
(
Map
.
Entry
<
String
,
DataSource
>
entry
:
this
.
dataSources
.
entrySet
())
{
composite
.
addHealthIndicator
(
entry
.
getKey
(),
new
SimpleDataSourceHealthIndicator
(
entry
.
getValue
()));
composite
.
addHealthIndicator
(
entry
.
getKey
(),
new
SimpleDataSourceHealthIndicator
(
entry
.
getValue
()));
}
return
composite
;
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
View file @
1acffdf6
...
...
@@ -59,9 +59,9 @@ public class HealthEndpoint extends AbstractEndpoint<Map<String, Object>> {
* Turns the bean name into a key that can be used in the map of health information.
*/
private
String
getKey
(
String
name
)
{
int
x
=
name
.
toLowerCase
().
indexOf
(
"healthindicator"
);
if
(
x
>
0
)
{
return
name
.
substring
(
0
,
x
);
int
inde
x
=
name
.
toLowerCase
().
indexOf
(
"healthindicator"
);
if
(
inde
x
>
0
)
{
return
name
.
substring
(
0
,
inde
x
);
}
return
name
;
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/MongoHealthIndicator.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,6 +20,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.util.Assert
;
import
com.mongodb.CommandResult
;
...
...
@@ -35,6 +36,7 @@ public class MongoHealthIndicator implements HealthIndicator<Map<String, Object>
private
final
MongoTemplate
mongoTemplate
;
public
MongoHealthIndicator
(
MongoTemplate
mongoTemplate
)
{
Assert
.
notNull
(
mongoTemplate
,
"MongoTemplate must not be null"
);
this
.
mongoTemplate
=
mongoTemplate
;
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/RedisHealthIndicator.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -23,6 +23,7 @@ import java.util.Properties;
import
org.springframework.data.redis.connection.RedisConnection
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisConnectionUtils
;
import
org.springframework.util.Assert
;
/**
* Simple implementation of a {@link HealthIndicator} returning status information for
...
...
@@ -36,6 +37,7 @@ public class RedisHealthIndicator implements HealthIndicator<Map<String, Object>
private
final
RedisConnectionFactory
redisConnectionFactory
;
public
RedisHealthIndicator
(
RedisConnectionFactory
connectionFactory
)
{
Assert
.
notNull
(
connectionFactory
,
"ConnectionFactory must not be null"
);
this
.
redisConnectionFactory
=
connectionFactory
;
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfigurationTests.java
View file @
1acffdf6
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -120,7 +120,7 @@ public class HealthIndicatorAutoConfigurationTests {
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
assertEquals
(
1
,
beans
.
size
());
assertEquals
(
SimpleDataSourceHealthIndicator
.
class
,
beans
.
values
().
iterator
()
.
next
()
.
getClass
());
assertEquals
(
SimpleDataSourceHealthIndicator
.
class
,
beans
.
values
().
iterator
()
.
next
().
getClass
());
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/HealthEndpointTests.java
View file @
1acffdf6
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/MongoHealthIndicatorTests.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/RedisHealthIndicatorTests.java
View file @
1acffdf6
/*
* Copyright 2014 the original author or authors.
* Copyright 201
2-201
4 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
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