Commit 58df752a authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Polish

See gh-13790
parent 43091150
...@@ -61,8 +61,8 @@ org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoCon ...@@ -61,8 +61,8 @@ org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoCon
org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.neo4j.Neo4jHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.redis.RedisHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.redis.RedisHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.security.reactive.ReactiveManagementWebSecurityAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.session.SessionsEndpointAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.session.SessionsEndpointAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.solr.SolrHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.solr.SolrHealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorAutoConfiguration,\ org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorAutoConfiguration,\
......
...@@ -119,12 +119,9 @@ public class ReactiveManagementWebSecurityAutoConfigurationTests { ...@@ -119,12 +119,9 @@ public class ReactiveManagementWebSecurityAutoConfigurationTests {
@Test @Test
public void backsOffWhenWebFilterChainProxyBeanPresent() { public void backsOffWhenWebFilterChainProxyBeanPresent() {
this.contextRunner this.contextRunner.withUserConfiguration(WebFilterChainProxyConfiguration.class)
.withConfiguration(
AutoConfigurations.of(ReactiveSecurityAutoConfiguration.class))
.withUserConfiguration(WebFilterChainProxyConfiguration.class)
.run((context) -> { .run((context) -> {
assertThat(getLocationHeader(context, "/health").toString()) assertThat(getLocationHeader(context, "/actuator/health").toString())
.contains("/login"); .contains("/login");
assertThat(getLocationHeader(context, "/foo").toString()) assertThat(getLocationHeader(context, "/foo").toString())
.contains("/login"); .contains("/login");
......
...@@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit; ...@@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.MockClock; import io.micrometer.core.instrument.MockClock;
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.simple.SimpleConfig; import io.micrometer.core.instrument.simple.SimpleConfig;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.junit.Before; import org.junit.Before;
...@@ -128,14 +129,10 @@ public class MetricsWebClientFilterFunctionTests { ...@@ -128,14 +129,10 @@ public class MetricsWebClientFilterFunctionTests {
this.filterFunction.filter(request, exchange).retry(1) this.filterFunction.filter(request, exchange).retry(1)
.onErrorResume(IllegalArgumentException.class, (t) -> Mono.empty()) .onErrorResume(IllegalArgumentException.class, (t) -> Mono.empty())
.block(); .block();
assertThat(this.registry Timer timer = this.registry.get("http.client.requests").tags("method", "GET",
.get("http.client.requests").tags("method", "GET", "uri", "uri", "/projects/spring-boot", "status", "CLIENT_ERROR").timer();
"/projects/spring-boot", "status", "CLIENT_ERROR") assertThat(timer.count()).isEqualTo(2);
.timer().count()).isEqualTo(2); assertThat(timer.max(TimeUnit.MILLISECONDS)).isLessThan(600);
assertThat(this.registry.get("http.client.requests")
.tags("method", "GET", "uri", "/projects/spring-boot", "status",
"CLIENT_ERROR")
.timer().max(TimeUnit.MILLISECONDS)).isLessThan(600);
} }
} }
...@@ -1026,16 +1026,16 @@ ...@@ -1026,16 +1026,16 @@
<artifactId>javax.mail-api</artifactId> <artifactId>javax.mail-api</artifactId>
<version>${javax-mail.version}</version> <version>${javax-mail.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>${javax-persistence.version}</version>
</dependency>
<dependency> <dependency>
<groupId>javax.money</groupId> <groupId>javax.money</groupId>
<artifactId>money-api</artifactId> <artifactId>money-api</artifactId>
<version>${javax-money.version}</version> <version>${javax-money.version}</version>
</dependency> </dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>${javax-persistence.version}</version>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
......
...@@ -3260,8 +3260,8 @@ default. The `management.endpoints.web.exposure.include` property can be used to ...@@ -3260,8 +3260,8 @@ default. The `management.endpoints.web.exposure.include` property can be used to
the actuators. the actuators.
If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is
present, all actuators other than `/health` and `/info` are secured by Spring Boot auto-config. present, all actuators other than `/health` and `/info` are secured by Spring Boot auto-configuration.
If you define a custom `WebSecurityConfigurerAdapter`, Spring Boot auto-config will back off and you will be in If you define a custom `WebSecurityConfigurerAdapter`, Spring Boot auto-configuration will back off and you will be in
full control of actuator access rules. full control of actuator access rules.
NOTE: Before setting the `management.endpoints.web.exposure.include`, ensure that the NOTE: Before setting the `management.endpoints.web.exposure.include`, ensure that the
......
...@@ -19,6 +19,7 @@ package org.springframework.boot.context.properties; ...@@ -19,6 +19,7 @@ package org.springframework.boot.context.properties;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects;
import org.springframework.core.env.PropertySource; import org.springframework.core.env.PropertySource;
import org.springframework.core.env.PropertySources; import org.springframework.core.env.PropertySources;
...@@ -45,23 +46,14 @@ final class CompositePropertySources implements PropertySources { ...@@ -45,23 +46,14 @@ final class CompositePropertySources implements PropertySources {
@Override @Override
public boolean contains(String name) { public boolean contains(String name) {
for (PropertySources sources : this.propertySources) { return this.propertySources.stream()
if (sources.contains(name)) { .anyMatch((sources) -> sources.contains(name));
return true;
}
}
return false;
} }
@Override @Override
public PropertySource<?> get(String name) { public PropertySource<?> get(String name) {
for (PropertySources sources : this.propertySources) { return this.propertySources.stream().map((sources) -> sources.get(name))
PropertySource<?> source = sources.get(name); .filter(Objects::nonNull).findFirst().orElse(null);
if (source != null) {
return source;
}
}
return null;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment