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
e7a3b3c4
Commit
e7a3b3c4
authored
Aug 11, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
cf2bf0c2
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
104 deletions
+123
-104
ServletWebManagementContextFactory.java
...ate/autoconfigure/ServletWebManagementContextFactory.java
+1
-2
CachingConfigurationFactory.java
.../endpoint/infrastructure/CachingConfigurationFactory.java
+3
-4
JmxEndpointExporter.java
...onfigure/endpoint/infrastructure/JmxEndpointExporter.java
+5
-6
EndpointEnablementProvider.java
...onfigure/endpoint/support/EndpointEnablementProvider.java
+6
-5
HealthWebEndpointExtension.java
...boot/actuate/endpoint/web/HealthWebEndpointExtension.java
+1
-1
CachingConfigurationFactoryTests.java
...oint/infrastructure/CachingConfigurationFactoryTests.java
+0
-1
EndpointEnablementProviderTests.java
...ure/endpoint/support/EndpointEnablementProviderTests.java
+102
-80
EnvironmentEndpointTests.java
...ework/boot/actuate/endpoint/EnvironmentEndpointTests.java
+1
-1
EnvironmentEndpointWebIntegrationTests.java
.../endpoint/web/EnvironmentEndpointWebIntegrationTests.java
+4
-4
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ServletWebManagementContextFactory.java
View file @
e7a3b3c4
...
@@ -44,8 +44,7 @@ class ServletWebManagementContextFactory implements ManagementContextFactory {
...
@@ -44,8 +44,7 @@ class ServletWebManagementContextFactory implements ManagementContextFactory {
ApplicationContext
parent
,
Class
<?>...
configClasses
)
{
ApplicationContext
parent
,
Class
<?>...
configClasses
)
{
AnnotationConfigServletWebServerApplicationContext
child
=
new
AnnotationConfigServletWebServerApplicationContext
();
AnnotationConfigServletWebServerApplicationContext
child
=
new
AnnotationConfigServletWebServerApplicationContext
();
child
.
setParent
(
parent
);
child
.
setParent
(
parent
);
List
<
Class
<?>>
combinedClasses
=
new
ArrayList
<
Class
<?>>(
List
<
Class
<?>>
combinedClasses
=
new
ArrayList
<>(
Arrays
.
asList
(
configClasses
));
Arrays
.
asList
(
configClasses
));
combinedClasses
.
add
(
ServletWebServerFactoryAutoConfiguration
.
class
);
combinedClasses
.
add
(
ServletWebServerFactoryAutoConfiguration
.
class
);
child
.
register
(
combinedClasses
.
toArray
(
new
Class
<?>[
combinedClasses
.
size
()]));
child
.
register
(
combinedClasses
.
toArray
(
new
Class
<?>[
combinedClasses
.
size
()]));
registerServletWebServerFactory
(
parent
,
child
);
registerServletWebServerFactory
(
parent
,
child
);
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/CachingConfigurationFactory.java
View file @
e7a3b3c4
...
@@ -22,13 +22,12 @@ import org.springframework.boot.endpoint.CachingConfiguration;
...
@@ -22,13 +22,12 @@ import org.springframework.boot.endpoint.CachingConfiguration;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.env.Environment
;
/**
/**
* A {@link CachingConfiguration} factory that use the {@link Environment} to extract
* A {@link CachingConfiguration} factory that use the {@link Environment} to extract
the
*
the
caching settings of each endpoint.
* caching settings of each endpoint.
*
*
* @author Stephane Nicoll
* @author Stephane Nicoll
*/
*/
class
CachingConfigurationFactory
class
CachingConfigurationFactory
implements
Function
<
String
,
CachingConfiguration
>
{
implements
Function
<
String
,
CachingConfiguration
>
{
private
final
Environment
environment
;
private
final
Environment
environment
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/JmxEndpointExporter.java
View file @
e7a3b3c4
...
@@ -53,8 +53,7 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
...
@@ -53,8 +53,7 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
private
Collection
<
ObjectName
>
registeredObjectNames
;
private
Collection
<
ObjectName
>
registeredObjectNames
;
JmxEndpointExporter
(
EndpointProvider
<
JmxEndpointOperation
>
endpointProvider
,
JmxEndpointExporter
(
EndpointProvider
<
JmxEndpointOperation
>
endpointProvider
,
EndpointMBeanRegistrar
endpointMBeanRegistrar
,
EndpointMBeanRegistrar
endpointMBeanRegistrar
,
ObjectMapper
objectMapper
)
{
ObjectMapper
objectMapper
)
{
this
.
endpointProvider
=
endpointProvider
;
this
.
endpointProvider
=
endpointProvider
;
this
.
endpointMBeanRegistrar
=
endpointMBeanRegistrar
;
this
.
endpointMBeanRegistrar
=
endpointMBeanRegistrar
;
DataConverter
dataConverter
=
new
DataConverter
(
objectMapper
);
DataConverter
dataConverter
=
new
DataConverter
(
objectMapper
);
...
@@ -73,8 +72,8 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
...
@@ -73,8 +72,8 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
private
Collection
<
ObjectName
>
registerEndpointMBeans
()
{
private
Collection
<
ObjectName
>
registerEndpointMBeans
()
{
List
<
ObjectName
>
objectNames
=
new
ArrayList
<>();
List
<
ObjectName
>
objectNames
=
new
ArrayList
<>();
Collection
<
EndpointMBean
>
mBeans
=
this
.
mBeanFactory
.
createMBeans
(
Collection
<
EndpointMBean
>
mBeans
=
this
.
mBeanFactory
this
.
endpointProvider
.
getEndpoints
());
.
createMBeans
(
this
.
endpointProvider
.
getEndpoints
());
for
(
EndpointMBean
mBean
:
mBeans
)
{
for
(
EndpointMBean
mBean
:
mBeans
)
{
objectNames
.
add
(
this
.
endpointMBeanRegistrar
.
registerEndpointMBean
(
mBean
));
objectNames
.
add
(
this
.
endpointMBeanRegistrar
.
registerEndpointMBean
(
mBean
));
}
}
...
@@ -122,13 +121,13 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
...
@@ -122,13 +121,13 @@ class JmxEndpointExporter implements InitializingBean, DisposableBean {
if
(
responseType
.
equals
(
String
.
class
))
{
if
(
responseType
.
equals
(
String
.
class
))
{
return
String
.
class
;
return
String
.
class
;
}
}
if
(
responseType
.
isArray
()
||
Collection
.
class
.
isAssignableFrom
(
responseType
))
{
if
(
responseType
.
isArray
()
||
Collection
.
class
.
isAssignableFrom
(
responseType
))
{
return
List
.
class
;
return
List
.
class
;
}
}
return
Map
.
class
;
return
Map
.
class
;
}
}
}
}
}
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProvider.java
View file @
e7a3b3c4
...
@@ -55,7 +55,8 @@ public class EndpointEnablementProvider {
...
@@ -55,7 +55,8 @@ public class EndpointEnablementProvider {
* @param endpointId the id of the endpoint
* @param endpointId the id of the endpoint
* @param enabledByDefault whether the endpoint is enabled by default or not
* @param enabledByDefault whether the endpoint is enabled by default or not
* @param endpointType the requested {@link EndpointType}
* @param endpointType the requested {@link EndpointType}
* @return the {@link EndpointEnablement} of that endpoint for the specified {@link EndpointType}
* @return the {@link EndpointEnablement} of that endpoint for the specified
* {@link EndpointType}
*/
*/
public
EndpointEnablement
getEndpointEnablement
(
String
endpointId
,
public
EndpointEnablement
getEndpointEnablement
(
String
endpointId
,
boolean
enabledByDefault
,
EndpointType
endpointType
)
{
boolean
enabledByDefault
,
EndpointType
endpointType
)
{
...
@@ -92,9 +93,8 @@ public class EndpointEnablementProvider {
...
@@ -92,9 +93,8 @@ public class EndpointEnablementProvider {
// All endpoints specific attributes have been looked at. Checking default value
// All endpoints specific attributes have been looked at. Checking default value
// for the endpoint
// for the endpoint
if
(!
enabledByDefault
)
{
if
(!
enabledByDefault
)
{
return
new
EndpointEnablement
(
false
,
return
new
EndpointEnablement
(
false
,
createDefaultEnablementMessage
(
createDefaultEnablementMessage
(
endpointId
,
enabledByDefault
,
endpointId
,
enabledByDefault
,
endpointType
));
endpointType
));
}
}
if
(
endpointType
!=
null
)
{
if
(
endpointType
!=
null
)
{
...
@@ -106,7 +106,8 @@ public class EndpointEnablementProvider {
...
@@ -106,7 +106,8 @@ public class EndpointEnablementProvider {
}
}
else
{
else
{
// Check if there is a global tech required
// Check if there is a global tech required
EndpointEnablement
anyTechGeneralOutcome
=
getAnyTechSpecificOutcomeFor
(
"all"
);
EndpointEnablement
anyTechGeneralOutcome
=
getAnyTechSpecificOutcomeFor
(
"all"
);
if
(
anyTechGeneralOutcome
!=
null
)
{
if
(
anyTechGeneralOutcome
!=
null
)
{
return
anyTechGeneralOutcome
;
return
anyTechGeneralOutcome
;
}
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/HealthWebEndpointExtension.java
View file @
e7a3b3c4
...
@@ -100,7 +100,7 @@ public class HealthWebEndpointExtension {
...
@@ -100,7 +100,7 @@ public class HealthWebEndpointExtension {
public
WebEndpointResponse
<
Health
>
getHealth
()
{
public
WebEndpointResponse
<
Health
>
getHealth
()
{
Health
health
=
this
.
delegate
.
health
();
Health
health
=
this
.
delegate
.
health
();
Integer
status
=
getStatus
(
health
);
Integer
status
=
getStatus
(
health
);
return
new
WebEndpointResponse
<
Health
>(
health
,
status
);
return
new
WebEndpointResponse
<>(
health
,
status
);
}
}
private
int
getStatus
(
Health
health
)
{
private
int
getStatus
(
Health
health
)
{
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/CachingConfigurationFactoryTests.java
View file @
e7a3b3c4
...
@@ -23,7 +23,6 @@ import org.springframework.mock.env.MockEnvironment;
...
@@ -23,7 +23,6 @@ import org.springframework.mock.env.MockEnvironment;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
/**
* Tests for {@link CachingConfigurationFactory}.
* Tests for {@link CachingConfigurationFactory}.
*
*
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProviderTests.java
View file @
e7a3b3c4
This diff is collapsed.
Click to expand it.
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpointTests.java
View file @
e7a3b3c4
...
@@ -196,7 +196,7 @@ public class EnvironmentEndpointTests {
...
@@ -196,7 +196,7 @@ public class EnvironmentEndpointTests {
public
void
propertyWithTypeOtherThanStringShouldNotFail
()
{
public
void
propertyWithTypeOtherThanStringShouldNotFail
()
{
StandardEnvironment
environment
=
new
StandardEnvironment
();
StandardEnvironment
environment
=
new
StandardEnvironment
();
MutablePropertySources
propertySources
=
environment
.
getPropertySources
();
MutablePropertySources
propertySources
=
environment
.
getPropertySources
();
Map
<
String
,
Object
>
source
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
source
=
new
HashMap
<>();
source
.
put
(
"foo"
,
Collections
.
singletonMap
(
"bar"
,
"baz"
));
source
.
put
(
"foo"
,
Collections
.
singletonMap
(
"bar"
,
"baz"
));
propertySources
.
addFirst
(
new
MapPropertySource
(
"test"
,
source
));
propertySources
.
addFirst
(
new
MapPropertySource
(
"test"
,
source
));
EnvironmentDescriptor
env
=
new
EnvironmentEndpoint
(
environment
)
EnvironmentDescriptor
env
=
new
EnvironmentEndpoint
(
environment
)
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EnvironmentEndpointWebIntegrationTests.java
View file @
e7a3b3c4
...
@@ -70,7 +70,7 @@ public class EnvironmentEndpointWebIntegrationTests {
...
@@ -70,7 +70,7 @@ public class EnvironmentEndpointWebIntegrationTests {
@Test
@Test
public
void
nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty
()
public
void
nestedPathWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty
()
throws
Exception
{
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"my.foo"
,
"${my.bar}"
);
map
.
put
(
"my.foo"
,
"${my.bar}"
);
context
.
getEnvironment
().
getPropertySources
()
context
.
getEnvironment
().
getPropertySources
()
.
addFirst
(
new
MapPropertySource
(
"unresolved-placeholder"
,
map
));
.
addFirst
(
new
MapPropertySource
(
"unresolved-placeholder"
,
map
));
...
@@ -81,7 +81,7 @@ public class EnvironmentEndpointWebIntegrationTests {
...
@@ -81,7 +81,7 @@ public class EnvironmentEndpointWebIntegrationTests {
@Test
@Test
public
void
nestedPathWithSensitivePlaceholderShouldSanitize
()
throws
Exception
{
public
void
nestedPathWithSensitivePlaceholderShouldSanitize
()
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"my.foo"
,
"${my.password}"
);
map
.
put
(
"my.foo"
,
"${my.password}"
);
map
.
put
(
"my.password"
,
"hello"
);
map
.
put
(
"my.password"
,
"hello"
);
context
.
getEnvironment
().
getPropertySources
()
context
.
getEnvironment
().
getPropertySources
()
...
@@ -94,7 +94,7 @@ public class EnvironmentEndpointWebIntegrationTests {
...
@@ -94,7 +94,7 @@ public class EnvironmentEndpointWebIntegrationTests {
@Test
@Test
public
void
nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty
()
public
void
nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty
()
throws
Exception
{
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"my.foo"
,
"${my.bar}"
);
map
.
put
(
"my.foo"
,
"${my.bar}"
);
context
.
getEnvironment
().
getPropertySources
()
context
.
getEnvironment
().
getPropertySources
()
.
addFirst
(
new
MapPropertySource
(
"unresolved-placeholder"
,
map
));
.
addFirst
(
new
MapPropertySource
(
"unresolved-placeholder"
,
map
));
...
@@ -108,7 +108,7 @@ public class EnvironmentEndpointWebIntegrationTests {
...
@@ -108,7 +108,7 @@ public class EnvironmentEndpointWebIntegrationTests {
@Test
@Test
public
void
nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize
()
public
void
nestedPathMatchedByRegexWithSensitivePlaceholderShouldSanitize
()
throws
Exception
{
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"my.foo"
,
"${my.password}"
);
map
.
put
(
"my.foo"
,
"${my.password}"
);
map
.
put
(
"my.password"
,
"hello"
);
map
.
put
(
"my.password"
,
"hello"
);
context
.
getEnvironment
().
getPropertySources
()
context
.
getEnvironment
().
getPropertySources
()
...
...
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