Skip to content

Commit ca8ebbf

Browse files
committed
Merge pull request #35576 from izeye
* pr/35576: Polish Closes gh-35576
2 parents f0ed2a8 + 1b5fc89 commit ca8ebbf

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ static class WebFilterChainPostProcessor implements BeanPostProcessor {
175175
@Override
176176
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
177177
if (bean instanceof WebFilterChainProxy webFilterChainProxy) {
178-
return postProcess(webFilterChainProxy, this.pathMappedEndpoints.get());
178+
return postProcess(webFilterChainProxy);
179179
}
180180
return bean;
181181
}
182182

183-
private WebFilterChainProxy postProcess(WebFilterChainProxy existing, PathMappedEndpoints pathMappedEndpoints) {
184-
List<String> paths = getPaths(pathMappedEndpoints);
183+
private WebFilterChainProxy postProcess(WebFilterChainProxy existing) {
184+
List<String> paths = getPaths(this.pathMappedEndpoints.get());
185185
ServerWebExchangeMatcher cloudFoundryRequestMatcher = ServerWebExchangeMatchers
186186
.pathMatchers(paths.toArray(new String[] {}));
187187
WebFilter noOpFilter = (exchange, chain) -> chain.filter(exchange);

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,9 @@ void cloudFoundryPathsIgnoredBySpringSecurity() {
205205
}
206206

207207
private static Boolean getMatches(List<SecurityWebFilterChain> filters, String urlTemplate) {
208-
Boolean cfBaseRequestMatches = filters.get(0)
208+
return filters.get(0)
209209
.matches(MockServerWebExchange.from(MockServerHttpRequest.get(urlTemplate).build()))
210210
.block(Duration.ofSeconds(30));
211-
return cfBaseRequestMatches;
212211
}
213212

214213
@Test

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfigurationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ class CloudFoundryActuatorAutoConfigurationTests {
6969

7070
private static final String V3_JSON = ApiVersion.V3.getProducedMimeType().toString();
7171

72+
private static final String BASE_PATH = "/cloudfoundryapplication";
73+
7274
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
7375
.withConfiguration(AutoConfigurations.of(SecurityAutoConfiguration.class, WebMvcAutoConfiguration.class,
7476
JacksonAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
@@ -77,8 +79,6 @@ class CloudFoundryActuatorAutoConfigurationTests {
7779
ServletManagementContextAutoConfiguration.class, EndpointAutoConfiguration.class,
7880
WebEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class));
7981

80-
private static String BASE_PATH = "/cloudfoundryapplication";
81-
8282
@Test
8383
void cloudFoundryPlatformActive() {
8484
this.contextRunner
@@ -189,9 +189,9 @@ void cloudFoundryPathsIgnoredBySpringSecurity() {
189189
});
190190
}
191191

192-
private static void testCloudFoundrySecurity(MockHttpServletRequest request, String basePath,
192+
private static void testCloudFoundrySecurity(MockHttpServletRequest request, String servletPath,
193193
SecurityFilterChain chain) {
194-
request.setServletPath(basePath);
194+
request.setServletPath(servletPath);
195195
assertThat(chain.matches(request)).isTrue();
196196
}
197197

0 commit comments

Comments
 (0)