mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Fix typo in IncludeExcludeEndpointFilter's name
Closes gh-21061
This commit is contained in:
parent
7d68c7c4c4
commit
3065c88d6f
@ -18,7 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.endpoint;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.core.env.Environment;
|
||||
@ -30,11 +30,11 @@ import org.springframework.core.env.Environment;
|
||||
* @param <E> the endpoint type
|
||||
* @author Phillip Webb
|
||||
* @since 2.0.0
|
||||
* @deprecated since 2.2.7 in favor of {@link IncludExcludeEndpointFilter}
|
||||
* @deprecated since 2.2.7 in favor of {@link IncludeExcludeEndpointFilter}
|
||||
*/
|
||||
@Deprecated
|
||||
public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
|
||||
extends IncludExcludeEndpointFilter<E> {
|
||||
extends IncludeExcludeEndpointFilter<E> {
|
||||
|
||||
public ExposeExcludePropertyEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
String... exposeDefaults) {
|
||||
|
@ -20,8 +20,8 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter.DefaultIncludes;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter.DefaultIncludes;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
|
||||
@ -87,7 +87,7 @@ class OnAvailableEndpointCondition extends AbstractEndpointCondition {
|
||||
return exposures;
|
||||
}
|
||||
|
||||
static class Exposure extends IncludExcludeEndpointFilter<ExposableEndpoint<?>> {
|
||||
static class Exposure extends IncludeExcludeEndpointFilter<ExposableEndpoint<?>> {
|
||||
|
||||
private final String prefix;
|
||||
|
||||
|
@ -40,7 +40,7 @@ import org.springframework.util.Assert;
|
||||
* @author Phillip Webb
|
||||
* @since 2.2.7
|
||||
*/
|
||||
public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> implements EndpointFilter<E> {
|
||||
public class IncludeExcludeEndpointFilter<E extends ExposableEndpoint<?>> implements EndpointFilter<E> {
|
||||
|
||||
private final Class<E> endpointType;
|
||||
|
||||
@ -51,7 +51,7 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
private final EndpointPatterns exclude;
|
||||
|
||||
/**
|
||||
* Create a new {@link IncludExcludeEndpointFilter} with include/exclude rules bound
|
||||
* Create a new {@link IncludeExcludeEndpointFilter} with include/exclude rules bound
|
||||
* from the {@link Environment}.
|
||||
* @param endpointType the endpoint type that should be considered (other types always
|
||||
* match)
|
||||
@ -59,13 +59,13 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
* @param prefix the property prefix to bind
|
||||
* @param defaultIncludes the default {@code includes} to use when none are specified.
|
||||
*/
|
||||
public IncludExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
public IncludeExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
String... defaultIncludes) {
|
||||
this(endpointType, environment, prefix, new EndpointPatterns(defaultIncludes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IncludExcludeEndpointFilter} with include/exclude rules bound
|
||||
* Create a new {@link IncludeExcludeEndpointFilter} with include/exclude rules bound
|
||||
* from the {@link Environment}.
|
||||
* @param endpointType the endpoint type that should be considered (other types always
|
||||
* match)
|
||||
@ -73,12 +73,12 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
* @param prefix the property prefix to bind
|
||||
* @param defaultIncludes the default {@code includes} to use when none are specified.
|
||||
*/
|
||||
public IncludExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
public IncludeExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
DefaultIncludes defaultIncludes) {
|
||||
this(endpointType, environment, prefix, DefaultIncludes.patterns(defaultIncludes));
|
||||
}
|
||||
|
||||
private IncludExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
private IncludeExcludeEndpointFilter(Class<E> endpointType, Environment environment, String prefix,
|
||||
EndpointPatterns defaultIncludes) {
|
||||
Assert.notNull(endpointType, "EndpointType must not be null");
|
||||
Assert.notNull(environment, "Environment must not be null");
|
||||
@ -92,7 +92,7 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IncludExcludeEndpointFilter} with specific include/exclude
|
||||
* Create a new {@link IncludeExcludeEndpointFilter} with specific include/exclude
|
||||
* rules.
|
||||
* @param endpointType the endpoint type that should be considered (other types always
|
||||
* match)
|
||||
@ -100,13 +100,13 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
* @param exclude the exclude patterns
|
||||
* @param defaultIncludes the default {@code includes} to use when none are specified.
|
||||
*/
|
||||
public IncludExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
public IncludeExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
String... defaultIncludes) {
|
||||
this(endpointType, include, exclude, new EndpointPatterns(defaultIncludes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link IncludExcludeEndpointFilter} with specific include/exclude
|
||||
* Create a new {@link IncludeExcludeEndpointFilter} with specific include/exclude
|
||||
* rules.
|
||||
* @param endpointType the endpoint type that should be considered (other types always
|
||||
* match)
|
||||
@ -114,12 +114,12 @@ public class IncludExcludeEndpointFilter<E extends ExposableEndpoint<?>> impleme
|
||||
* @param exclude the exclude patterns
|
||||
* @param defaultIncludes the default {@code includes} to use when none are specified.
|
||||
*/
|
||||
public IncludExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
public IncludeExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
DefaultIncludes defaultIncludes) {
|
||||
this(endpointType, include, exclude, DefaultIncludes.patterns(defaultIncludes));
|
||||
}
|
||||
|
||||
private IncludExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
private IncludeExcludeEndpointFilter(Class<E> endpointType, Collection<String> include, Collection<String> exclude,
|
||||
EndpointPatterns defaultIncludes) {
|
||||
Assert.notNull(endpointType, "EndpointType Type must not be null");
|
||||
Assert.notNull(defaultIncludes, "DefaultIncludes must not be null");
|
@ -23,7 +23,7 @@ import javax.management.MBeanServer;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.invoke.OperationInvokerAdvisor;
|
||||
@ -97,9 +97,9 @@ public class JmxEndpointAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IncludExcludeEndpointFilter<ExposableJmxEndpoint> jmxIncludeExcludePropertyEndpointFilter() {
|
||||
public IncludeExcludeEndpointFilter<ExposableJmxEndpoint> jmxIncludeExcludePropertyEndpointFilter() {
|
||||
JmxEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new IncludExcludeEndpointFilter<>(ExposableJmxEndpoint.class, exposure.getInclude(),
|
||||
return new IncludeExcludeEndpointFilter<>(ExposableJmxEndpoint.class, exposure.getInclude(),
|
||||
exposure.getExclude(), "*");
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
|
||||
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar;
|
||||
@ -47,10 +47,10 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
public class ServletEndpointManagementContextConfiguration {
|
||||
|
||||
@Bean
|
||||
public IncludExcludeEndpointFilter<ExposableServletEndpoint> servletExposeExcludePropertyEndpointFilter(
|
||||
public IncludeExcludeEndpointFilter<ExposableServletEndpoint> servletExposeExcludePropertyEndpointFilter(
|
||||
WebEndpointProperties properties) {
|
||||
WebEndpointProperties.Exposure exposure = properties.getExposure();
|
||||
return new IncludExcludeEndpointFilter<>(ExposableServletEndpoint.class, exposure.getInclude(),
|
||||
return new IncludeExcludeEndpointFilter<>(ExposableServletEndpoint.class, exposure.getInclude(),
|
||||
exposure.getExclude());
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter.DefaultIncludes;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter.DefaultIncludes;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointsSupplier;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
@ -113,16 +113,16 @@ public class WebEndpointAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IncludExcludeEndpointFilter<ExposableWebEndpoint> webExposeExcludePropertyEndpointFilter() {
|
||||
public IncludeExcludeEndpointFilter<ExposableWebEndpoint> webExposeExcludePropertyEndpointFilter() {
|
||||
WebEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new IncludExcludeEndpointFilter<>(ExposableWebEndpoint.class, exposure.getInclude(),
|
||||
return new IncludeExcludeEndpointFilter<>(ExposableWebEndpoint.class, exposure.getInclude(),
|
||||
exposure.getExclude(), DefaultIncludes.WEB);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IncludExcludeEndpointFilter<ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
|
||||
public IncludeExcludeEndpointFilter<ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
|
||||
WebEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new IncludExcludeEndpointFilter<>(ExposableControllerEndpoint.class, exposure.getInclude(),
|
||||
return new IncludeExcludeEndpointFilter<>(ExposableControllerEndpoint.class, exposure.getInclude(),
|
||||
exposure.getExclude());
|
||||
}
|
||||
|
||||
|
@ -32,13 +32,13 @@ import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Tests for {@link IncludExcludeEndpointFilter}.
|
||||
* Tests for {@link IncludeExcludeEndpointFilter}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class IncludExcludeEndpointFilterTests {
|
||||
class IncludeExcludeEndpointFilterTests {
|
||||
|
||||
private IncludExcludeEndpointFilter<?> filter;
|
||||
private IncludeExcludeEndpointFilter<?> filter;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
@ -48,14 +48,14 @@ class IncludExcludeEndpointFilterTests {
|
||||
@Test
|
||||
void createWhenEndpointTypeIsNullShouldThrowException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new IncludExcludeEndpointFilter<>(null, new MockEnvironment(), "foo"))
|
||||
.isThrownBy(() -> new IncludeExcludeEndpointFilter<>(null, new MockEnvironment(), "foo"))
|
||||
.withMessageContaining("EndpointType must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createWhenEnvironmentIsNullShouldThrowException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new IncludExcludeEndpointFilter<>(ExposableEndpoint.class, null, "foo"))
|
||||
.isThrownBy(() -> new IncludeExcludeEndpointFilter<>(ExposableEndpoint.class, null, "foo"))
|
||||
.withMessageContaining("Environment must not be null");
|
||||
}
|
||||
|
||||
@ -63,14 +63,15 @@ class IncludExcludeEndpointFilterTests {
|
||||
void createWhenPrefixIsNullShouldThrowException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(
|
||||
() -> new IncludExcludeEndpointFilter<>(ExposableEndpoint.class, new MockEnvironment(), null))
|
||||
() -> new IncludeExcludeEndpointFilter<>(ExposableEndpoint.class, new MockEnvironment(), null))
|
||||
.withMessageContaining("Prefix must not be empty");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createWhenPrefixIsEmptyShouldThrowException() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new IncludExcludeEndpointFilter<>(ExposableEndpoint.class, new MockEnvironment(), ""))
|
||||
.isThrownBy(
|
||||
() -> new IncludeExcludeEndpointFilter<>(ExposableEndpoint.class, new MockEnvironment(), ""))
|
||||
.withMessageContaining("Prefix must not be empty");
|
||||
}
|
||||
|
||||
@ -121,7 +122,7 @@ class IncludExcludeEndpointFilterTests {
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.setProperty("foo.include", "bar");
|
||||
environment.setProperty("foo.exclude", "");
|
||||
this.filter = new IncludExcludeEndpointFilter<>(DifferentTestExposableWebEndpoint.class, environment, "foo");
|
||||
this.filter = new IncludeExcludeEndpointFilter<>(DifferentTestExposableWebEndpoint.class, environment, "foo");
|
||||
assertThat(match(EndpointId.of("baz"))).isTrue();
|
||||
}
|
||||
|
||||
@ -157,7 +158,7 @@ class IncludExcludeEndpointFilterTests {
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.setProperty("foo.include", include);
|
||||
environment.setProperty("foo.exclude", exclude);
|
||||
this.filter = new IncludExcludeEndpointFilter<>(TestExposableWebEndpoint.class, environment, "foo", "def");
|
||||
this.filter = new IncludeExcludeEndpointFilter<>(TestExposableWebEndpoint.class, environment, "foo", "def");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.expose.IncludeExcludeEndpointFilter;
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType;
|
||||
@ -104,7 +104,7 @@ class WebEndpointAutoConfigurationTests {
|
||||
@Test
|
||||
void webApplicationConfiguresExposeExcludePropertyEndpointFilter() {
|
||||
this.contextRunner
|
||||
.run((context) -> assertThat(context).getBeans(IncludExcludeEndpointFilter.class).containsKeys(
|
||||
.run((context) -> assertThat(context).getBeans(IncludeExcludeEndpointFilter.class).containsKeys(
|
||||
"webExposeExcludePropertyEndpointFilter", "controllerExposeExcludePropertyEndpointFilter"));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user