Remove EndpointProperties
`EndpointProperties` is a left over of the infrastructure in 1.x and is no longer used. Besides the `endpoints.enabled` property is now `endpoints.all.enabled`. Closes gh-10016
This commit is contained in:
parent
151f7ef325
commit
74b552826b
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.endpoint;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Global endpoint properties.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "endpoints")
|
||||
public class EndpointProperties {
|
||||
|
||||
private static final String ENDPOINTS_ENABLED_PROPERTY = "endpoints.enabled";
|
||||
|
||||
/**
|
||||
* Enable endpoints.
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an endpoint is enabled based on its specific property and taking into
|
||||
* account the global default.
|
||||
* @param environment the Spring environment or {@code null}.
|
||||
* @param enabled the endpoint property or {@code null}
|
||||
* @return if the endpoint is enabled
|
||||
*/
|
||||
public static boolean isEnabled(Environment environment, Boolean enabled) {
|
||||
if (enabled != null) {
|
||||
return enabled;
|
||||
}
|
||||
if (environment != null
|
||||
&& environment.containsProperty(ENDPOINTS_ENABLED_PROPERTY)) {
|
||||
return environment.getProperty(ENDPOINTS_ENABLED_PROPERTY, Boolean.class);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1083,7 +1083,7 @@ content into your application; rather pick only the properties that you need.
|
|||
# ----------------------------------------
|
||||
|
||||
# ENDPOINTS ({sc-spring-boot-actuator}/endpoint/AbstractEndpoint.{sc-ext}[AbstractEndpoint] subclasses)
|
||||
endpoints.enabled=true # Enable endpoints.
|
||||
endpoints.all.enabled=true # Enable all endpoints.
|
||||
endpoints.auditevents.enabled= # Enable the endpoint.
|
||||
endpoints.autoconfig.enabled= # Enable the endpoint.
|
||||
endpoints.beans.enabled= # Enable the endpoint.
|
||||
|
|
|
|||
|
|
@ -208,12 +208,12 @@ NOTE: The prefix ‟`endpoints` + `.` + `name`” is used to uniquely identify t
|
|||
that is being configured.
|
||||
|
||||
By default, all endpoints except for `shutdown` are enabled. If you prefer to
|
||||
specifically "`opt-in`" endpoint enablement you can use the `endpoints.enabled` property.
|
||||
For example, the following will disable _all_ endpoints except for `info`:
|
||||
specifically "`opt-in`" endpoint enablement you can use the `endpoints.all.enabled`
|
||||
property. For example, the following will disable _all_ endpoints except for `info`:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
endpoints.enabled=false
|
||||
endpoints.all.enabled=false
|
||||
endpoints.info.enabled=true
|
||||
----
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue