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
5e736c0d
Commit
5e736c0d
authored
Jan 07, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x'
parents
e907bf0c
6ad01a6d
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
79 additions
and
64 deletions
+79
-64
AuditEventsEndpointAutoConfiguration.java
...configure/audit/AuditEventsEndpointAutoConfiguration.java
+2
-2
BeansEndpointAutoConfiguration.java
...e/autoconfigure/beans/BeansEndpointAutoConfiguration.java
+2
-2
CachesEndpointAutoConfiguration.java
.../autoconfigure/cache/CachesEndpointAutoConfiguration.java
+2
-3
ConditionsReportEndpointAutoConfiguration.java
.../condition/ConditionsReportEndpointAutoConfiguration.java
+2
-2
ShutdownEndpointAutoConfiguration.java
...oconfigure/context/ShutdownEndpointAutoConfiguration.java
+2
-2
ConfigurationPropertiesReportEndpointAutoConfiguration.java
...nfigurationPropertiesReportEndpointAutoConfiguration.java
+2
-2
ConditionalOnEnabledEndpoint.java
...gure/endpoint/condition/ConditionalOnEnabledEndpoint.java
+2
-2
OnEnabledEndpointCondition.java
...figure/endpoint/condition/OnEnabledEndpointCondition.java
+12
-12
EnvironmentEndpointAutoConfiguration.java
...toconfigure/env/EnvironmentEndpointAutoConfiguration.java
+2
-3
FlywayEndpointAutoConfiguration.java
...autoconfigure/flyway/FlywayEndpointAutoConfiguration.java
+2
-2
HealthEndpointConfiguration.java
...ate/autoconfigure/health/HealthEndpointConfiguration.java
+2
-2
HealthEndpointWebExtensionConfiguration.java
...igure/health/HealthEndpointWebExtensionConfiguration.java
+3
-3
InfoEndpointAutoConfiguration.java
...ate/autoconfigure/info/InfoEndpointAutoConfiguration.java
+2
-2
IntegrationGraphEndpointAutoConfiguration.java
...ntegration/IntegrationGraphEndpointAutoConfiguration.java
+2
-3
JolokiaEndpointAutoConfiguration.java
...toconfigure/jolokia/JolokiaEndpointAutoConfiguration.java
+2
-2
LiquibaseEndpointAutoConfiguration.java
...nfigure/liquibase/LiquibaseEndpointAutoConfiguration.java
+2
-3
LoggersEndpointAutoConfiguration.java
...toconfigure/logging/LoggersEndpointAutoConfiguration.java
+2
-2
HeapDumpWebEndpointAutoConfiguration.java
...gure/management/HeapDumpWebEndpointAutoConfiguration.java
+2
-2
ThreadDumpEndpointAutoConfiguration.java
...igure/management/ThreadDumpEndpointAutoConfiguration.java
+2
-2
MetricsEndpointAutoConfiguration.java
...toconfigure/metrics/MetricsEndpointAutoConfiguration.java
+2
-2
PrometheusMetricsExportAutoConfiguration.java
.../prometheus/PrometheusMetricsExportAutoConfiguration.java
+2
-2
ScheduledTasksEndpointAutoConfiguration.java
...e/scheduling/ScheduledTasksEndpointAutoConfiguration.java
+2
-2
SessionsEndpointAutoConfiguration.java
...oconfigure/session/SessionsEndpointAutoConfiguration.java
+2
-2
HttpTraceEndpointAutoConfiguration.java
...figure/trace/http/HttpTraceEndpointAutoConfiguration.java
+2
-2
ConditionalOnEnabledEndpointTests.java
...endpoint/condition/ConditionalOnEnabledEndpointTests.java
+20
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -37,12 +37,12 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@AutoConfigureAfter
(
AuditAutoConfiguration
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
AuditEventsEndpoint
.
class
)
public
class
AuditEventsEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean
(
AuditEventRepository
.
class
)
@ConditionalOnEnabledEndpoint
public
AuditEventsEndpoint
auditEventsEndpoint
(
AuditEventRepository
auditEventRepository
)
{
return
new
AuditEventsEndpoint
(
auditEventRepository
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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,11 +31,11 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
BeansEndpoint
.
class
)
public
class
BeansEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
BeansEndpoint
beansEndpoint
(
ConfigurableApplicationContext
applicationContext
)
{
return
new
BeansEndpoint
(
applicationContext
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -42,12 +42,12 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnClass
(
CacheManager
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
CachesEndpoint
.
class
)
@AutoConfigureAfter
(
CacheAutoConfiguration
.
class
)
public
class
CachesEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
CachesEndpoint
cachesEndpoint
(
ObjectProvider
<
Map
<
String
,
CacheManager
>>
cacheManagers
)
{
return
new
CachesEndpoint
(
cacheManagers
.
getIfAvailable
(
LinkedHashMap:
:
new
));
...
...
@@ -55,7 +55,6 @@ public class CachesEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
@ConditionalOnBean
(
CachesEndpoint
.
class
)
public
CachesEndpointWebExtension
cachesEndpointWebExtension
(
CachesEndpoint
cachesEndpoint
)
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,11 +32,11 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
ConditionsReportEndpoint
.
class
)
public
class
ConditionsReportEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
(
search
=
SearchStrategy
.
CURRENT
)
@ConditionalOnEnabledEndpoint
public
ConditionsReportEndpoint
conditionsReportEndpoint
(
ConfigurableApplicationContext
context
)
{
return
new
ConditionsReportEndpoint
(
context
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/ShutdownEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -30,11 +30,11 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
ShutdownEndpoint
.
class
)
public
class
ShutdownEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
ShutdownEndpoint
shutdownEndpoint
()
{
return
new
ShutdownEndpoint
();
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -33,6 +33,7 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
ConfigurationPropertiesReportEndpoint
.
class
)
@EnableConfigurationProperties
(
ConfigurationPropertiesReportEndpointProperties
.
class
)
public
class
ConfigurationPropertiesReportEndpointAutoConfiguration
{
...
...
@@ -45,7 +46,6 @@ public class ConfigurationPropertiesReportEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
ConfigurationPropertiesReportEndpoint
configurationPropertiesReportEndpoint
()
{
ConfigurationPropertiesReportEndpoint
endpoint
=
new
ConfigurationPropertiesReportEndpoint
();
String
[]
keysToSanitize
=
this
.
properties
.
getKeysToSanitize
();
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpoint.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -92,7 +92,7 @@ import org.springframework.core.env.Environment;
* @see Endpoint
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
METHOD
)
@Target
(
{
ElementType
.
METHOD
,
ElementType
.
TYPE
}
)
@Documented
@Conditional
(
OnEnabledEndpointCondition
.
class
)
public
@interface
ConditionalOnEnabledEndpoint
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -90,15 +90,11 @@ class OnEnabledEndpointCondition extends SpringBootCondition {
private
AnnotationAttributes
getEndpointAttributes
(
ConditionContext
context
,
AnnotatedTypeMetadata
metadata
)
{
Assert
.
state
(
metadata
instanceof
MethodMetadata
&&
metadata
.
isAnnotated
(
Bean
.
class
.
getName
()),
"OnEnabledEndpointCondition may only be used on @Bean methods"
);
Class
<?>
endpointType
=
getEndpointType
(
context
,
(
MethodMetadata
)
metadata
);
return
getEndpointAttributes
(
endpointType
);
return
getEndpointAttributes
(
getEndpointType
(
context
,
metadata
));
}
private
Class
<?>
getEndpointType
(
ConditionContext
context
,
MethodMetadata
metadata
)
{
private
Class
<?>
getEndpointType
(
ConditionContext
context
,
AnnotatedTypeMetadata
metadata
)
{
Map
<
String
,
Object
>
attributes
=
metadata
.
getAnnotationAttributes
(
ConditionalOnEnabledEndpoint
.
class
.
getName
());
if
(
attributes
!=
null
&&
attributes
.
containsKey
(
"endpoint"
))
{
...
...
@@ -107,15 +103,19 @@ class OnEnabledEndpointCondition extends SpringBootCondition {
return
target
;
}
}
// We should be safe to load at this point since we are in the REGISTER_BEAN phase
Assert
.
state
(
metadata
instanceof
MethodMetadata
&&
metadata
.
isAnnotated
(
Bean
.
class
.
getName
()),
"OnEnabledEndpointCondition must be used on @Bean methods when the endpoint is not specified"
);
MethodMetadata
methodMetadata
=
(
MethodMetadata
)
metadata
;
try
{
return
ClassUtils
.
forName
(
metadata
.
getReturnTypeName
(),
return
ClassUtils
.
forName
(
met
hodMet
adata
.
getReturnTypeName
(),
context
.
getClassLoader
());
}
catch
(
Throwable
ex
)
{
throw
new
IllegalStateException
(
"Failed to extract endpoint id for "
+
met
adata
.
getDeclaringClassName
()
+
"."
+
metadata
.
getMethodName
(),
ex
);
+
met
hodMetadata
.
getDeclaringClassName
()
+
"."
+
methodMetadata
.
getMethodName
(),
ex
);
}
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,6 +35,7 @@ import org.springframework.core.env.Environment;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
EnvironmentEndpoint
.
class
)
@EnableConfigurationProperties
(
EnvironmentEndpointProperties
.
class
)
public
class
EnvironmentEndpointAutoConfiguration
{
...
...
@@ -47,7 +48,6 @@ public class EnvironmentEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
EnvironmentEndpoint
environmentEndpoint
(
Environment
environment
)
{
EnvironmentEndpoint
endpoint
=
new
EnvironmentEndpoint
(
environment
);
String
[]
keysToSanitize
=
this
.
properties
.
getKeysToSanitize
();
...
...
@@ -59,7 +59,6 @@ public class EnvironmentEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
@ConditionalOnBean
(
EnvironmentEndpoint
.
class
)
public
EnvironmentEndpointWebExtension
environmentEndpointWebExtension
(
EnvironmentEndpoint
environmentEndpoint
)
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -38,13 +38,13 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnClass
(
Flyway
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
FlywayEndpoint
.
class
)
@AutoConfigureAfter
(
FlywayAutoConfiguration
.
class
)
public
class
FlywayEndpointAutoConfiguration
{
@Bean
@ConditionalOnBean
(
Flyway
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
FlywayEndpoint
flywayEndpoint
(
ApplicationContext
context
)
{
return
new
FlywayEndpoint
(
context
);
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -33,11 +33,11 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnSingleCandidate
(
HealthIndicatorRegistry
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
HealthEndpoint
.
class
)
class
HealthEndpointConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
HealthEndpoint
healthEndpoint
(
HealthAggregator
healthAggregator
,
HealthIndicatorRegistry
registry
)
{
return
new
HealthEndpoint
(
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -69,6 +69,7 @@ class HealthEndpointWebExtensionConfiguration {
@Configuration
@ConditionalOnWebApplication
(
type
=
Type
.
REACTIVE
)
@ConditionalOnSingleCandidate
(
ReactiveHealthIndicatorRegistry
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
HealthEndpoint
.
class
)
static
class
ReactiveWebHealthConfiguration
{
private
final
ReactiveHealthIndicator
reactiveHealthIndicator
;
...
...
@@ -82,7 +83,6 @@ class HealthEndpointWebExtensionConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
@ConditionalOnBean
(
HealthEndpoint
.
class
)
public
ReactiveHealthEndpointWebExtension
reactiveHealthEndpointWebExtension
(
HealthWebEndpointResponseMapper
responseMapper
)
{
...
...
@@ -94,11 +94,11 @@ class HealthEndpointWebExtensionConfiguration {
@Configuration
@ConditionalOnWebApplication
(
type
=
Type
.
SERVLET
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
HealthEndpoint
.
class
)
static
class
ServletWebHealthConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
@ConditionalOnBean
(
HealthEndpoint
.
class
)
public
HealthEndpointWebExtension
healthEndpointWebExtension
(
HealthEndpoint
healthEndpoint
,
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,12 +35,12 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
InfoEndpoint
.
class
)
@AutoConfigureAfter
(
InfoContributorAutoConfiguration
.
class
)
public
class
InfoEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
InfoEndpoint
infoEndpoint
(
ObjectProvider
<
InfoContributor
>
infoContributors
)
{
return
new
InfoEndpoint
(
infoContributors
.
orderedStream
().
collect
(
Collectors
.
toList
()));
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/integration/IntegrationGraphEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,12 +40,12 @@ import org.springframework.integration.graph.IntegrationGraphServer;
@Configuration
@ConditionalOnClass
(
IntegrationGraphServer
.
class
)
@ConditionalOnBean
(
IntegrationConfigurationBeanFactoryPostProcessor
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
IntegrationGraphEndpoint
.
class
)
@AutoConfigureAfter
(
IntegrationAutoConfiguration
.
class
)
public
class
IntegrationGraphEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
IntegrationGraphEndpoint
integrationGraphEndpoint
(
IntegrationGraphServer
integrationGraphServer
)
{
return
new
IntegrationGraphEndpoint
(
integrationGraphServer
);
...
...
@@ -53,7 +53,6 @@ public class IntegrationGraphEndpointAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
(
endpoint
=
IntegrationGraphEndpoint
.
class
)
public
IntegrationGraphServer
integrationGraphServer
()
{
return
new
IntegrationGraphServer
();
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,11 +36,11 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ConditionalOnWebApplication
(
type
=
Type
.
SERVLET
)
@ConditionalOnClass
(
AgentServlet
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
JolokiaEndpoint
.
class
)
@EnableConfigurationProperties
(
JolokiaProperties
.
class
)
public
class
JolokiaEndpointAutoConfiguration
{
@Bean
@ConditionalOnEnabledEndpoint
public
JolokiaEndpoint
jolokiaEndpoint
(
JolokiaProperties
properties
)
{
return
new
JolokiaEndpoint
(
properties
.
getConfig
());
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -41,20 +41,19 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnClass
(
SpringLiquibase
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
LiquibaseEndpoint
.
class
)
@AutoConfigureAfter
(
LiquibaseAutoConfiguration
.
class
)
public
class
LiquibaseEndpointAutoConfiguration
{
@Bean
@ConditionalOnBean
(
SpringLiquibase
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
LiquibaseEndpoint
liquibaseEndpoint
(
ApplicationContext
context
)
{
return
new
LiquibaseEndpoint
(
context
);
}
@Bean
@ConditionalOnBean
(
SpringLiquibase
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
LiquibaseEndpoint
.
class
)
public
static
BeanPostProcessor
preventDataSourceCloseBeanPostProcessor
()
{
return
new
BeanPostProcessor
()
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -38,13 +38,13 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
LoggersEndpoint
.
class
)
public
class
LoggersEndpointAutoConfiguration
{
@Bean
@ConditionalOnBean
(
LoggingSystem
.
class
)
@Conditional
(
OnEnabledLoggingSystemCondition
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
LoggersEndpoint
loggersEndpoint
(
LoggingSystem
loggingSystem
)
{
return
new
LoggersEndpoint
(
loggingSystem
);
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -30,11 +30,11 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
HeapDumpWebEndpoint
.
class
)
public
class
HeapDumpWebEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
HeapDumpWebEndpoint
heapDumpWebEndpoint
()
{
return
new
HeapDumpWebEndpoint
();
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -30,11 +30,11 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
ThreadDumpEndpoint
.
class
)
public
class
ThreadDumpEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
ThreadDumpEndpoint
dumpEndpoint
()
{
return
new
ThreadDumpEndpoint
();
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -37,6 +37,7 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@ConditionalOnClass
(
Timed
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
MetricsEndpoint
.
class
)
@AutoConfigureAfter
({
MetricsAutoConfiguration
.
class
,
CompositeMeterRegistryAutoConfiguration
.
class
})
public
class
MetricsEndpointAutoConfiguration
{
...
...
@@ -44,7 +45,6 @@ public class MetricsEndpointAutoConfiguration {
@Bean
@ConditionalOnBean
(
MeterRegistry
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
MetricsEndpoint
metricsEndpoint
(
MeterRegistry
registry
)
{
return
new
MetricsEndpoint
(
registry
);
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -82,10 +82,10 @@ public class PrometheusMetricsExportAutoConfiguration {
}
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
PrometheusScrapeEndpoint
.
class
)
public
static
class
PrometheusScrapeEndpointConfiguration
{
@Bean
@ConditionalOnEnabledEndpoint
@ConditionalOnMissingBean
public
PrometheusScrapeEndpoint
prometheusEndpoint
(
CollectorRegistry
collectorRegistry
)
{
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/scheduling/ScheduledTasksEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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,11 +34,11 @@ import org.springframework.scheduling.config.ScheduledTaskHolder;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
ScheduledTasksEndpoint
.
class
)
public
class
ScheduledTasksEndpointAutoConfiguration
{
@Bean
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
ScheduledTasksEndpoint
scheduledTasksEndpoint
(
ObjectProvider
<
ScheduledTaskHolder
>
holders
)
{
return
new
ScheduledTasksEndpoint
(
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/session/SessionsEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -37,13 +37,13 @@ import org.springframework.session.Session;
*/
@Configuration
@ConditionalOnClass
(
FindByIndexNameSessionRepository
.
class
)
@ConditionalOnEnabledEndpoint
(
endpoint
=
SessionsEndpoint
.
class
)
@AutoConfigureAfter
(
SessionAutoConfiguration
.
class
)
public
class
SessionsEndpointAutoConfiguration
{
@Bean
@ConditionalOnBean
(
FindByIndexNameSessionRepository
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
SessionsEndpoint
sessionEndpoint
(
FindByIndexNameSessionRepository
<?
extends
Session
>
sessionRepository
)
{
return
new
SessionsEndpoint
(
sessionRepository
);
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceEndpointAutoConfiguration.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -33,13 +33,13 @@ import org.springframework.context.annotation.Configuration;
* @since 2.0.0
*/
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
HttpTraceEndpoint
.
class
)
@AutoConfigureAfter
(
HttpTraceAutoConfiguration
.
class
)
public
class
HttpTraceEndpointAutoConfiguration
{
@Bean
@ConditionalOnBean
(
HttpTraceRepository
.
class
)
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public
HttpTraceEndpoint
httpTraceEndpoint
(
HttpTraceRepository
traceRepository
)
{
return
new
HttpTraceEndpoint
(
traceRepository
);
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java
View file @
5e736c0d
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
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.
...
...
@@ -148,6 +148,14 @@ public class ConditionalOnEnabledEndpointTests {
.
run
((
context
)
->
assertThat
(
context
).
hasBean
(
"fooBar"
));
}
@Test
public
void
outcomeWhenEndpointEnabledPropertyIsFalseOnClassShouldNotMatch
()
{
this
.
contextRunner
.
withPropertyValues
(
"management.endpoint.foo.enabled=false"
)
.
withUserConfiguration
(
FooEndpointEnabledByDefaultTrueOnConfigurationConfiguration
.
class
)
.
run
((
context
)
->
assertThat
(
context
).
doesNotHaveBean
(
"foo"
));
}
@Endpoint
(
id
=
"foo"
,
enableByDefault
=
true
)
static
class
FooEndpointEnabledByDefaultTrue
{
...
...
@@ -193,6 +201,17 @@ public class ConditionalOnEnabledEndpointTests {
}
@Configuration
@ConditionalOnEnabledEndpoint
(
endpoint
=
FooEndpointEnabledByDefaultTrue
.
class
)
static
class
FooEndpointEnabledByDefaultTrueOnConfigurationConfiguration
{
@Bean
public
FooEndpointEnabledByDefaultTrue
foo
()
{
return
new
FooEndpointEnabledByDefaultTrue
();
}
}
@Configuration
static
class
FooEndpointEnabledByDefaultFalseConfiguration
{
...
...
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