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
a3afc859
Commit
a3afc859
authored
Feb 23, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.3.x'
parents
2da9f6d9
617c9732
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
275 additions
and
38 deletions
+275
-38
AutoConfigurationReportEndpoint.java
...oot/actuate/endpoint/AutoConfigurationReportEndpoint.java
+2
-2
BeansEndpoint.java
.../springframework/boot/actuate/endpoint/BeansEndpoint.java
+2
-2
ConfigurationPropertiesReportEndpoint.java
...tuate/endpoint/ConfigurationPropertiesReportEndpoint.java
+2
-2
DumpEndpoint.java
...g/springframework/boot/actuate/endpoint/DumpEndpoint.java
+2
-2
EnvironmentEndpoint.java
...gframework/boot/actuate/endpoint/EnvironmentEndpoint.java
+2
-2
FlywayEndpoint.java
...springframework/boot/actuate/endpoint/FlywayEndpoint.java
+2
-2
HealthEndpoint.java
...springframework/boot/actuate/endpoint/HealthEndpoint.java
+2
-2
InfoEndpoint.java
...g/springframework/boot/actuate/endpoint/InfoEndpoint.java
+2
-2
LiquibaseEndpoint.java
...ingframework/boot/actuate/endpoint/LiquibaseEndpoint.java
+2
-2
RequestMappingEndpoint.java
...amework/boot/actuate/endpoint/RequestMappingEndpoint.java
+1
-1
ShutdownEndpoint.java
...ringframework/boot/actuate/endpoint/ShutdownEndpoint.java
+2
-2
TraceEndpoint.java
.../springframework/boot/actuate/endpoint/TraceEndpoint.java
+2
-2
AbstractEndpointMvcAdapter.java
...boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java
+4
-1
DocsMvcEndpoint.java
...gframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java
+4
-1
EnvironmentMvcEndpoint.java
...ork/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java
+3
-1
HalJsonMvcEndpoint.java
...amework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java
+1
-1
HealthMvcEndpoint.java
...ramework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
+3
-1
JolokiaMvcEndpoint.java
...amework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java
+3
-3
LogFileMvcEndpoint.java
...amework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java
+2
-2
MetricsMvcEndpoint.java
...amework/boot/actuate/endpoint/mvc/MetricsMvcEndpoint.java
+3
-1
MvcEndpoints.java
...ringframework/boot/actuate/endpoint/mvc/MvcEndpoints.java
+18
-3
ShutdownMvcEndpoint.java
...mework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java
+3
-1
additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+35
-0
MvcEndpointPathConfigurationTests.java
...uate/autoconfigure/MvcEndpointPathConfigurationTests.java
+171
-0
MvcEndpointsTests.java
...ramework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java
+2
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AutoConfigurationReportEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -44,7 +44,7 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
* @author Andy Wilkinson
*/
@ConfigurationProperties
(
prefix
=
"endpoints.autoconfig"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.autoconfig"
)
public
class
AutoConfigurationReportEndpoint
extends
AbstractEndpoint
<
Report
>
{
@Autowired
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/BeansEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -35,7 +35,7 @@ import org.springframework.core.env.Environment;
*
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.beans"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.beans"
)
public
class
BeansEndpoint
extends
AbstractEndpoint
<
List
<
Object
>>
implements
ApplicationContextAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ConfigurationPropertiesReportEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -58,7 +58,7 @@ import org.springframework.util.StringUtils;
* @author Christian Dupuis
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.configprops"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.configprops"
)
public
class
ConfigurationPropertiesReportEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
implements
ApplicationContextAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/DumpEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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,7 +28,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
*
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.dump"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.dump"
)
public
class
DumpEndpoint
extends
AbstractEndpoint
<
List
<
ThreadInfo
>>
{
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EnvironmentEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -36,7 +36,7 @@ import org.springframework.core.env.StandardEnvironment;
* @author Phillip Webb
* @author Christian Dupuis
*/
@ConfigurationProperties
(
prefix
=
"endpoints.env"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.env"
)
public
class
EnvironmentEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
{
private
final
Sanitizer
sanitizer
=
new
Sanitizer
();
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
* @author Phillip Webb
* @since 1.3.0
*/
@ConfigurationProperties
(
prefix
=
"endpoints.flyway"
,
ignoreUnknownFields
=
true
)
@ConfigurationProperties
(
prefix
=
"endpoints.flyway"
)
public
class
FlywayEndpoint
extends
AbstractEndpoint
<
List
<
FlywayMigration
>>
{
private
final
Flyway
flyway
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -32,7 +32,7 @@ import org.springframework.util.Assert;
* @author Christian Dupuis
* @author Andy Wilkinson
*/
@ConfigurationProperties
(
prefix
=
"endpoints.health"
,
ignoreUnknownFields
=
true
)
@ConfigurationProperties
(
prefix
=
"endpoints.health"
)
public
class
HealthEndpoint
extends
AbstractEndpoint
<
Health
>
{
private
final
HealthIndicator
healthIndicator
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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,7 +28,7 @@ import org.springframework.util.Assert;
*
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.info"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.info"
)
public
class
InfoEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
{
private
final
Map
<
String
,
?
extends
Object
>
info
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/LiquibaseEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
* @author Eddú Meléndez
* @since 1.3.0
*/
@ConfigurationProperties
(
prefix
=
"endpoints.liquibase"
,
ignoreUnknownFields
=
true
)
@ConfigurationProperties
(
prefix
=
"endpoints.liquibase"
)
public
class
LiquibaseEndpoint
extends
AbstractEndpoint
<
List
<
Map
<
String
,
?>>>
{
private
final
SpringLiquibase
liquibase
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/RequestMappingEndpoint.java
View file @
a3afc859
...
...
@@ -38,7 +38,7 @@ import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
* @author Dave Syer
* @author Andy Wilkinson
*/
@ConfigurationProperties
(
prefix
=
"endpoints.mappings"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.mappings"
)
public
class
RequestMappingEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
implements
ApplicationContextAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -31,7 +31,7 @@ import org.springframework.context.ConfigurableApplicationContext;
* @author Dave Syer
* @author Christian Dupuis
*/
@ConfigurationProperties
(
prefix
=
"endpoints.shutdown"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.shutdown"
)
public
class
ShutdownEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
implements
ApplicationContextAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TraceEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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,7 +28,7 @@ import org.springframework.util.Assert;
*
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.trace"
,
ignoreUnknownFields
=
false
)
@ConfigurationProperties
(
prefix
=
"endpoints.trace"
)
public
class
TraceEndpoint
extends
AbstractEndpoint
<
List
<
Trace
>>
{
private
final
TraceRepository
repository
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointMvcAdapter.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -34,6 +34,9 @@ public abstract class AbstractEndpointMvcAdapter<E extends Endpoint<?>>
private
final
E
delegate
;
/**
* Endpoint URL path.
*/
private
String
path
;
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -40,6 +40,9 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter
private
Environment
environment
;
/**
* Endpoint URL path.
*/
private
String
path
=
"/docs"
;
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/EnvironmentMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
mvc
;
import
org.springframework.boot.actuate.endpoint.EnvironmentEndpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.EnvironmentAware
;
import
org.springframework.core.env.ConfigurableEnvironment
;
import
org.springframework.core.env.EnumerablePropertySource
;
...
...
@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* @author Christian Dupuis
* @author Andy Wilkinson
*/
@ConfigurationProperties
(
prefix
=
"endpoints.env"
)
public
class
EnvironmentMvcEndpoint
extends
EndpointMvcAdapter
implements
EnvironmentAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java
View file @
a3afc859
...
...
@@ -49,7 +49,7 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter
* Endpoint URL path.
*/
@NotNull
@Pattern
(
regexp
=
"^$|/
[^/]
*"
,
message
=
"Path must be empty or start with /"
)
@Pattern
(
regexp
=
"^$|/
.
*"
,
message
=
"Path must be empty or start with /"
)
private
String
path
;
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -25,6 +25,7 @@ import org.springframework.boot.actuate.health.Health;
import
org.springframework.boot.actuate.health.Status
;
import
org.springframework.boot.bind.RelaxedNames
;
import
org.springframework.boot.bind.RelaxedPropertyResolver
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.EnvironmentAware
;
import
org.springframework.core.env.Environment
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -46,6 +47,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
* @author Phillip Webb
* @since 1.1.0
*/
@ConfigurationProperties
(
prefix
=
"endpoints.health"
)
public
class
HealthMvcEndpoint
extends
AbstractEndpointMvcAdapter
<
HealthEndpoint
>
implements
EnvironmentAware
{
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
6
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.
...
...
@@ -59,8 +59,8 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
* Endpoint URL path.
*/
@NotNull
@Pattern
(
regexp
=
"/
[^?#]
*"
,
message
=
"Path must start with /"
)
private
String
path
=
"/jolokia"
;
;
@Pattern
(
regexp
=
"/
.
*"
,
message
=
"Path must start with /"
)
private
String
path
=
"/jolokia"
;
/**
* Enable the endpoint.
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -59,7 +59,7 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware {
* Endpoint URL path.
*/
@NotNull
@Pattern
(
regexp
=
"/
[^/]
*"
,
message
=
"Path must start with /"
)
@Pattern
(
regexp
=
"/
.
*"
,
message
=
"Path must start with /"
)
private
String
path
=
"/logfile"
;
/**
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MetricsMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.endpoint.mvc;
import
java.util.Map
;
import
org.springframework.boot.actuate.endpoint.MetricsEndpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseStatus;
* @author Andy Wilkinson
* @author Sergei Egorov
*/
@ConfigurationProperties
(
prefix
=
"endpoints.metrics"
)
public
class
MetricsMvcEndpoint
extends
EndpointMvcAdapter
{
private
final
MetricsEndpoint
delegate
;
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpoints.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.
...
...
@@ -24,9 +24,13 @@ import org.springframework.beans.BeansException;
import
org.springframework.beans.factory.BeanFactoryUtils
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
/**
* A registry for all {@link MvcEndpoint} beans, and a factory for a set of generic ones
...
...
@@ -64,8 +68,8 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean {
for
(
Endpoint
<?>
endpoint
:
delegates
)
{
if
(
isGenericEndpoint
(
endpoint
.
getClass
())
&&
endpoint
.
isEnabled
())
{
EndpointMvcAdapter
adapter
=
new
EndpointMvcAdapter
(
endpoint
);
String
path
=
this
.
applicationContext
.
getEnvironment
()
.
getProperty
(
"endpoints."
+
endpoint
.
getId
()
+
".path"
);
String
path
=
determinePath
(
endpoint
,
this
.
applicationContext
.
getEnvironment
()
);
if
(
path
!=
null
)
{
adapter
.
setPath
(
path
);
}
...
...
@@ -94,4 +98,15 @@ public class MvcEndpoints implements ApplicationContextAware, InitializingBean {
&&
!
MvcEndpoint
.
class
.
isAssignableFrom
(
type
);
}
private
String
determinePath
(
Endpoint
<?>
endpoint
,
Environment
environment
)
{
ConfigurationProperties
configurationProperties
=
AnnotationUtils
.
findAnnotation
(
endpoint
.
getClass
(),
ConfigurationProperties
.
class
);
if
(
configurationProperties
!=
null
)
{
String
prefix
=
StringUtils
.
hasText
(
configurationProperties
.
prefix
())
?
configurationProperties
.
prefix
()
:
configurationProperties
.
value
();
return
environment
.
getProperty
(
prefix
+
".path"
);
}
return
null
;
}
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ShutdownMvcEndpoint.java
View file @
a3afc859
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
6
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.Collections;
import
java.util.Map
;
import
org.springframework.boot.actuate.endpoint.ShutdownEndpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -31,6 +32,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
*
* @author Dave Syer
*/
@ConfigurationProperties
(
prefix
=
"endpoints.shutdown"
)
public
class
ShutdownMvcEndpoint
extends
EndpointMvcAdapter
{
public
ShutdownMvcEndpoint
(
ShutdownEndpoint
delegate
)
{
...
...
spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json
View file @
a3afc859
{
"properties"
:
[
{
"name"
:
"endpoints.autoconfig.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.beans.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.configprops.keys-to-sanitize"
,
"type"
:
"java.lang.String[]"
,
"sourceType"
:
"org.springframework.boot.actuate.endpoint.ConfigurationPropertiesReportEndpoint"
,
"description"
:
"Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions."
},
{
"name"
:
"endpoints.configprops.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.dump.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.env.keys-to-sanitize"
,
"type"
:
"java.lang.String[]"
,
"sourceType"
:
"org.springframework.boot.actuate.endpoint.EnvironmentEndpoint"
,
"description"
:
"Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions."
},
{
"name"
:
"endpoints.info.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.jmx.enabled"
,
"type"
:
"java.lang.Boolean"
,
"description"
:
"Enable JMX export of all endpoints."
,
"defaultValue"
:
true
},
{
"name"
:
"endpoints.mappings.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"endpoints.metrics.filter.enabled"
,
"type"
:
"java.lang.Boolean"
,
"description"
:
"Enable the metrics servlet filter."
,
"defaultValue"
:
true
},
{
"name"
:
"endpoints.trace.path"
,
"type"
:
"java.lang.String"
,
"description"
:
"Endpoint URL path."
},
{
"name"
:
"info"
,
"type"
:
"java.util.Map<java.lang.String,java.lang.Object>"
,
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/MvcEndpointPathConfigurationTests.java
0 → 100644
View file @
a3afc859
/*
* Copyright 2012-2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
;
import
liquibase.integration.spring.SpringLiquibase
;
import
org.flywaydb.core.Flyway
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Parameterized
;
import
org.junit.runners.Parameterized.Parameters
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint
;
import
org.springframework.boot.actuate.endpoint.BeansEndpoint
;
import
org.springframework.boot.actuate.endpoint.ConfigurationPropertiesReportEndpoint
;
import
org.springframework.boot.actuate.endpoint.DumpEndpoint
;
import
org.springframework.boot.actuate.endpoint.FlywayEndpoint
;
import
org.springframework.boot.actuate.endpoint.InfoEndpoint
;
import
org.springframework.boot.actuate.endpoint.LiquibaseEndpoint
;
import
org.springframework.boot.actuate.endpoint.RequestMappingEndpoint
;
import
org.springframework.boot.actuate.endpoint.ShutdownEndpoint
;
import
org.springframework.boot.actuate.endpoint.TraceEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.DocsMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter
;
import
org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.HalJsonMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.LogFileMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.ManagementServletContext
;
import
org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints
;
import
org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport
;
import
org.springframework.boot.autoconfigure.test.ImportAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
;
import
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
* Tests for configuring the path of an MVC endpoint.
*
* @author Andy Wilkinson
*/
@RunWith
(
Parameterized
.
class
)
public
class
MvcEndpointPathConfigurationTests
{
private
final
String
endpointName
;
private
final
Class
<?>
endpointClass
;
private
AnnotationConfigWebApplicationContext
context
;
@After
public
void
cleanUp
()
{
if
(
this
.
context
!=
null
)
{
this
.
context
.
close
();
}
}
@Parameters
(
name
=
"{0}"
)
public
static
Object
[]
parameters
()
{
return
new
Object
[]
{
new
Object
[]
{
"actuator"
,
HalJsonMvcEndpoint
.
class
},
new
Object
[]
{
"autoconfig"
,
AutoConfigurationReportEndpoint
.
class
},
new
Object
[]
{
"beans"
,
BeansEndpoint
.
class
},
new
Object
[]
{
"configprops"
,
ConfigurationPropertiesReportEndpoint
.
class
},
new
Object
[]
{
"docs"
,
DocsMvcEndpoint
.
class
},
new
Object
[]
{
"dump"
,
DumpEndpoint
.
class
},
new
Object
[]
{
"env"
,
EnvironmentMvcEndpoint
.
class
},
new
Object
[]
{
"flyway"
,
FlywayEndpoint
.
class
},
new
Object
[]
{
"health"
,
HealthMvcEndpoint
.
class
},
new
Object
[]
{
"info"
,
InfoEndpoint
.
class
},
new
Object
[]
{
"jolokia"
,
JolokiaMvcEndpoint
.
class
},
new
Object
[]
{
"liquibase"
,
LiquibaseEndpoint
.
class
},
new
Object
[]
{
"logfile"
,
LogFileMvcEndpoint
.
class
},
new
Object
[]
{
"mappings"
,
RequestMappingEndpoint
.
class
},
new
Object
[]
{
"metrics"
,
MetricsMvcEndpoint
.
class
},
new
Object
[]
{
"shutdown"
,
ShutdownEndpoint
.
class
},
new
Object
[]
{
"trace"
,
TraceEndpoint
.
class
}
};
}
public
MvcEndpointPathConfigurationTests
(
String
endpointName
,
Class
<?>
endpointClass
)
{
this
.
endpointName
=
endpointName
;
this
.
endpointClass
=
endpointClass
;
}
@Test
public
void
pathCanBeConfigured
()
{
this
.
context
=
new
AnnotationConfigWebApplicationContext
();
this
.
context
.
register
(
TestConfiguration
.
class
);
this
.
context
.
setServletContext
(
new
MockServletContext
());
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"endpoints."
+
this
.
endpointName
+
".path"
+
":/custom/path"
,
"endpoints."
+
this
.
endpointName
+
".enabled:true"
,
"logging.file:target/test.log"
);
this
.
context
.
refresh
();
assertThat
(
getConfiguredPath
()).
isEqualTo
(
"/custom/path"
);
}
private
String
getConfiguredPath
()
{
if
(
MvcEndpoint
.
class
.
isAssignableFrom
(
this
.
endpointClass
))
{
return
((
MvcEndpoint
)
this
.
context
.
getBean
(
this
.
endpointClass
)).
getPath
();
}
for
(
MvcEndpoint
endpoint
:
this
.
context
.
getBean
(
MvcEndpoints
.
class
)
.
getEndpoints
())
{
if
(
endpoint
instanceof
EndpointMvcAdapter
&&
this
.
endpointClass
.
isInstance
(((
EndpointMvcAdapter
)
endpoint
).
getDelegate
()))
{
return
((
EndpointMvcAdapter
)
endpoint
).
getPath
();
}
}
throw
new
IllegalStateException
(
"Could not get configured path for "
+
this
.
endpointClass
);
}
@Configuration
@ImportAutoConfiguration
({
EndpointAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
,
ManagementServerPropertiesAutoConfiguration
.
class
,
ServerPropertiesAutoConfiguration
.
class
,
EndpointWebMvcAutoConfiguration
.
class
,
JolokiaAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
})
protected
static
class
TestConfiguration
{
@Bean
public
ConditionEvaluationReport
conditionEvaluationReport
(
ConfigurableListableBeanFactory
beanFactory
)
{
return
ConditionEvaluationReport
.
get
(
beanFactory
);
}
@Bean
public
FlywayEndpoint
flyway
()
{
return
new
FlywayEndpoint
(
new
Flyway
());
}
@Bean
public
LiquibaseEndpoint
liquibase
()
{
return
new
LiquibaseEndpoint
(
new
SpringLiquibase
());
}
@Bean
public
DocsMvcEndpoint
docs
(
ManagementServletContext
managementServletContext
)
{
return
new
DocsMvcEndpoint
(
managementServletContext
);
}
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointsTests.java
View file @
a3afc859
...
...
@@ -19,6 +19,7 @@ package org.springframework.boot.actuate.endpoint.mvc;
import
org.junit.Test
;
import
org.springframework.boot.actuate.endpoint.AbstractEndpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.support.StaticApplicationContext
;
...
...
@@ -77,6 +78,7 @@ public class MvcEndpointsTests {
.
isEqualTo
(
"/foo/bar"
);
}
@ConfigurationProperties
(
"endpoints.test"
)
protected
static
class
TestEndpoint
extends
AbstractEndpoint
<
String
>
{
public
TestEndpoint
()
{
...
...
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