diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointsSupplier.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointsSupplier.java index 2885a80a6d..93d104ad25 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointsSupplier.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointsSupplier.java @@ -24,6 +24,7 @@ import org.springframework.boot.actuate.endpoint.EndpointsSupplier; * @author Phillip Webb * @since 2.0.0 */ +@FunctionalInterface public interface JmxEndpointsSupplier extends EndpointsSupplier { } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoint.java index 00fcface5b..799968338e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoint.java @@ -26,6 +26,7 @@ import org.springframework.boot.actuate.endpoint.ExposableEndpoint; * @since 2.0.0 * @see PathMapper */ +@FunctionalInterface public interface PathMappedEndpoint { /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsSupplier.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsSupplier.java index 80ce5ab7ef..15bc503e6c 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsSupplier.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsSupplier.java @@ -24,6 +24,7 @@ import org.springframework.boot.actuate.endpoint.EndpointsSupplier; * @author Phillip Webb * @since 2.0.0 */ +@FunctionalInterface public interface WebEndpointsSupplier extends EndpointsSupplier { } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointsSupplier.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointsSupplier.java index a625b43db0..4f7b7be77e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointsSupplier.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ControllerEndpointsSupplier.java @@ -24,6 +24,7 @@ import org.springframework.boot.actuate.endpoint.EndpointsSupplier; * @author Phillip Webb * @since 2.0.0 */ +@FunctionalInterface public interface ControllerEndpointsSupplier extends EndpointsSupplier { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java index d494736428..9fd2d34172 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java @@ -238,8 +238,9 @@ public abstract class AbstractWebFluxEndpointHandlerMapping } /** - * An reactive web operation that can be handled by WebFlux. + * A reactive web operation that can be handled by WebFlux. */ + @FunctionalInterface protected interface ReactiveWebOperation { Mono> handle(ServerWebExchange exchange, diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java index 23712e5717..9602432094 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java @@ -214,8 +214,9 @@ public abstract class AbstractWebMvcEndpointHandlerMapping } /** - * An reactive web operation that can be handled by WebFlux. + * A servlet web operation that can be handled by Spring MVC. */ + @FunctionalInterface protected interface ServletWebOperation { Object handle(HttpServletRequest request, Map body); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java index e994b03da4..75be340a21 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/reactive/ControllerEndpointHandlerMappingIntegrationTests.java @@ -68,31 +68,27 @@ public class ControllerEndpointHandlerMappingIntegrationTests { @Test public void get() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.get().uri("/actuator/example/one").accept(MediaType.TEXT_PLAIN) - .exchange().expectStatus().isOk().expectHeader() - .contentTypeCompatibleWith(MediaType.TEXT_PLAIN) - .expectBody(String.class).isEqualTo("One"); - })); + this.contextRunner.run(withWebTestClient( + (webTestClient) -> webTestClient.get().uri("/actuator/example/one") + .accept(MediaType.TEXT_PLAIN).exchange().expectStatus().isOk() + .expectHeader().contentTypeCompatibleWith(MediaType.TEXT_PLAIN) + .expectBody(String.class).isEqualTo("One"))); } @Test public void getWithUnacceptableContentType() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.get().uri("/actuator/example/one") - .accept(MediaType.APPLICATION_JSON).exchange().expectStatus() - .isEqualTo(HttpStatus.NOT_ACCEPTABLE); - })); + this.contextRunner.run(withWebTestClient((webTestClient) -> webTestClient.get() + .uri("/actuator/example/one").accept(MediaType.APPLICATION_JSON) + .exchange().expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE))); } @Test public void post() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.post().uri("/actuator/example/two") - .syncBody(Collections.singletonMap("id", "test")).exchange() - .expectStatus().isCreated().expectHeader() - .valueEquals(HttpHeaders.LOCATION, "/example/test"); - })); + this.contextRunner.run(withWebTestClient( + (webTestClient) -> webTestClient.post().uri("/actuator/example/two") + .syncBody(Collections.singletonMap("id", "test")).exchange() + .expectStatus().isCreated().expectHeader() + .valueEquals(HttpHeaders.LOCATION, "/example/test"))); } private ContextConsumer withWebTestClient( diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java index 6800099e43..242a9e5591 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/servlet/ControllerEndpointHandlerMappingIntegrationTests.java @@ -67,31 +67,27 @@ public class ControllerEndpointHandlerMappingIntegrationTests { @Test public void get() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.get().uri("/actuator/example/one").accept(MediaType.TEXT_PLAIN) - .exchange().expectStatus().isOk().expectHeader() - .contentTypeCompatibleWith(MediaType.TEXT_PLAIN) - .expectBody(String.class).isEqualTo("One"); - })); + this.contextRunner.run(withWebTestClient( + (webTestClient) -> webTestClient.get().uri("/actuator/example/one") + .accept(MediaType.TEXT_PLAIN).exchange().expectStatus().isOk() + .expectHeader().contentTypeCompatibleWith(MediaType.TEXT_PLAIN) + .expectBody(String.class).isEqualTo("One"))); } @Test public void getWithUnacceptableContentType() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.get().uri("/actuator/example/one") - .accept(MediaType.APPLICATION_JSON).exchange().expectStatus() - .isEqualTo(HttpStatus.NOT_ACCEPTABLE); - })); + this.contextRunner.run(withWebTestClient((webTestClient) -> webTestClient.get() + .uri("/actuator/example/one").accept(MediaType.APPLICATION_JSON) + .exchange().expectStatus().isEqualTo(HttpStatus.NOT_ACCEPTABLE))); } @Test public void post() { - this.contextRunner.run(withWebTestClient(webTestClient -> { - webTestClient.post().uri("/actuator/example/two") - .syncBody(Collections.singletonMap("id", "test")).exchange() - .expectStatus().isCreated().expectHeader() - .valueEquals(HttpHeaders.LOCATION, "/example/test"); - })); + this.contextRunner.run(withWebTestClient( + (webTestClient) -> webTestClient.post().uri("/actuator/example/two") + .syncBody(Collections.singletonMap("id", "test")).exchange() + .expectStatus().isCreated().expectHeader() + .valueEquals(HttpHeaders.LOCATION, "/example/test"))); } private ContextConsumer withWebTestClient(