parent
40fd8888b2
commit
1e2e8b1d66
|
@ -33,7 +33,7 @@ import org.springframework.core.env.Environment;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link EndpointFilter} that will filter endpoints based on {@code expose} and
|
* {@link EndpointFilter} that will filter endpoints based on {@code include} and
|
||||||
* {@code exclude} properties.
|
* {@code exclude} properties.
|
||||||
*
|
*
|
||||||
* @param <E> The endpoint type
|
* @param <E> The endpoint type
|
||||||
|
@ -58,7 +58,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
|
||||||
Assert.hasText(prefix, "Prefix must not be empty");
|
Assert.hasText(prefix, "Prefix must not be empty");
|
||||||
Binder binder = Binder.get(environment);
|
Binder binder = Binder.get(environment);
|
||||||
this.endpointType = endpointType;
|
this.endpointType = endpointType;
|
||||||
this.include = bind(binder, prefix + ".expose");
|
this.include = bind(binder, prefix + ".include");
|
||||||
this.exclude = bind(binder, prefix + ".exclude");
|
this.exclude = bind(binder, prefix + ".exclude");
|
||||||
this.exposeDefaults = asSet(Arrays.asList(exposeDefaults));
|
this.exposeDefaults = asSet(Arrays.asList(exposeDefaults));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ExposeExcludePropertyEndpointFilterTests {
|
||||||
@Test
|
@Test
|
||||||
public void matchWhenDiscovererDoesNotMatchShouldMatch() {
|
public void matchWhenDiscovererDoesNotMatchShouldMatch() {
|
||||||
MockEnvironment environment = new MockEnvironment();
|
MockEnvironment environment = new MockEnvironment();
|
||||||
environment.setProperty("foo.expose", "bar");
|
environment.setProperty("foo.include", "bar");
|
||||||
environment.setProperty("foo.exclude", "");
|
environment.setProperty("foo.exclude", "");
|
||||||
this.filter = new ExposeExcludePropertyEndpointFilter<>(
|
this.filter = new ExposeExcludePropertyEndpointFilter<>(
|
||||||
DifferentTestExposableWebEndpoint.class, environment, "foo");
|
DifferentTestExposableWebEndpoint.class, environment, "foo");
|
||||||
|
@ -146,9 +146,9 @@ public class ExposeExcludePropertyEndpointFilterTests {
|
||||||
assertThat(match("buz")).isFalse();
|
assertThat(match("buz")).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFilter(String expose, String exclude) {
|
private void setupFilter(String include, String exclude) {
|
||||||
MockEnvironment environment = new MockEnvironment();
|
MockEnvironment environment = new MockEnvironment();
|
||||||
environment.setProperty("foo.expose", expose);
|
environment.setProperty("foo.include", include);
|
||||||
environment.setProperty("foo.exclude", exclude);
|
environment.setProperty("foo.exclude", exclude);
|
||||||
this.filter = new ExposeExcludePropertyEndpointFilter<>(
|
this.filter = new ExposeExcludePropertyEndpointFilter<>(
|
||||||
TestExposableWebEndpoint.class, environment, "foo", "def");
|
TestExposableWebEndpoint.class, environment, "foo", "def");
|
||||||
|
|
Loading…
Reference in New Issue