diff --git a/function/spring-http-request-function/README.adoc b/function/spring-http-request-function/README.adoc index e3f4bf01..943527cd 100644 --- a/function/spring-http-request-function/README.adoc +++ b/function/spring-http-request-function/README.adoc @@ -7,7 +7,7 @@ Users have to subscribe to the returned `Flux` to receive the data. ## Beans for injection -You can import the `HttpRequestFunction` configuration in a Spring Boot application and then inject the following bean. +The `HttpRequestFunction` auto-configuration provides the following bean: `httpRequestFunction` @@ -25,7 +25,7 @@ For more information on the various options available, please see link:src/main/ ## Examples -See this link:src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionApplicationTests.java[test suite] for examples of how this function is used. +See this link:src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTests.java[test suite] for examples of how this function is used. ## Other usage diff --git a/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionConfiguration.java b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionConfiguration.java index 67c3e973..f1c35a0b 100644 --- a/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionConfiguration.java +++ b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2022 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,34 +20,37 @@ import java.util.Map; import java.util.function.Function; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; +import org.springframework.expression.Expression; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.integration.config.IntegrationConverter; import org.springframework.messaging.Message; +import org.springframework.util.CollectionUtils; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.util.DefaultUriBuilderFactory; import org.springframework.web.util.UriBuilderFactory; /** - * Configuration for a {@link Function} that makes HTTP requests to a resource and for - * each request, returns a {@link ResponseEntity}. + * Auto-configuration for a {@link Function} that makes HTTP requests to a resource and + * for each request, returns a {@link ResponseEntity}. * * @author David Turanski * @author Sunny Hemdev * @author Corneil du Plessis **/ -@Configuration(proxyBeanMethods = false) +@AutoConfiguration @EnableConfigurationProperties(HttpRequestFunctionProperties.class) public class HttpRequestFunctionConfiguration { @Bean public HttpRequestFunction httpRequestFunction(WebClient.Builder webClientBuilder, HttpRequestFunctionProperties properties) { + return new HttpRequestFunction(webClientBuilder.build(), properties); } @@ -77,37 +80,39 @@ public HttpRequestFunction(WebClient webClient, HttpRequestFunctionProperties pr @Override public Object apply(Message message) { return this.webClient.method(resolveHttpMethod(message)) - .uri(uriBuilderFactory.uriString(resolveUrl(message)).build()) + .uri(this.uriBuilderFactory.uriString(resolveUrl(message)).build()) .bodyValue(resolveBody(message)) - .headers(httpHeaders -> httpHeaders.addAll(resolveHeaders(message))) + .headers((httpHeaders) -> httpHeaders.addAll(resolveHeaders(message))) .retrieve() - .toEntity(properties.getExpectedResponseType()) - .map(responseEntity -> properties.getReplyExpression().getValue(responseEntity)) - .timeout(Duration.ofMillis(properties.getTimeout())) + .toEntity(this.properties.getExpectedResponseType()) + .map((responseEntity) -> this.properties.getReplyExpression().getValue(responseEntity)) + .timeout(Duration.ofMillis(this.properties.getTimeout())) .block(); } private String resolveUrl(Message message) { - return properties.getUrlExpression().getValue(message, String.class); + return this.properties.getUrlExpression().getValue(message, String.class); } private HttpMethod resolveHttpMethod(Message message) { - return properties.getHttpMethodExpression().getValue(message, HttpMethod.class); + return this.properties.getHttpMethodExpression().getValue(message, HttpMethod.class); } private Object resolveBody(Message message) { - return properties.getBodyExpression() != null ? properties.getBodyExpression().getValue(message) + return (this.properties.getBodyExpression() != null) ? this.properties.getBodyExpression().getValue(message) : message.getPayload(); } private HttpHeaders resolveHeaders(Message message) { HttpHeaders headers = new HttpHeaders(); - if (properties.getHeadersExpression() != null) { - Map headersMap = properties.getHeadersExpression().getValue(message, Map.class); - for (Map.Entry header : headersMap.entrySet()) { - if (header.getKey() != null && header.getValue() != null) { - headers.add(header.getKey().toString(), header.getValue().toString()); - } + Expression headersExpression = this.properties.getHeadersExpression(); + if (headersExpression != null) { + Map headersMap = headersExpression.getValue(message, Map.class); + if (!CollectionUtils.isEmpty(headersMap)) { + headersMap.entrySet() + .stream() + .filter((entry) -> entry.getKey() != null && entry.getValue() != null) + .forEach((entry) -> headers.add(entry.getKey().toString(), entry.getValue().toString())); } } return headers; diff --git a/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionProperties.java b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionProperties.java index 50608ede..a0b0497b 100644 --- a/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionProperties.java +++ b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public class HttpRequestFunctionProperties { /** * A SpEL expression to derive the request method from the incoming message. */ - private Expression httpMethodExpression = new ValueExpression(HttpMethod.GET); + private Expression httpMethodExpression = new ValueExpression<>(HttpMethod.GET); /** * A SpEL expression to derive the request body from the incoming message. @@ -74,13 +74,13 @@ public class HttpRequestFunctionProperties { /** * A SpEL expression used to compute the final result, applied against the whole http - * {@link org.springframework.http.ResponseEntity}. + * {@link ResponseEntity}. */ - private Expression replyExpression = new FunctionExpression(ResponseEntity::getBody); + private Expression replyExpression = new FunctionExpression>(ResponseEntity::getBody); @NotNull public Expression getUrlExpression() { - return urlExpression; + return this.urlExpression; } public void setUrlExpression(Expression urlExpression) { @@ -88,7 +88,7 @@ public void setUrlExpression(Expression urlExpression) { } public Expression getHttpMethodExpression() { - return httpMethodExpression; + return this.httpMethodExpression; } public void setHttpMethodExpression(Expression httpMethodExpression) { @@ -97,7 +97,7 @@ public void setHttpMethodExpression(Expression httpMethodExpression) { @NotNull public Class getExpectedResponseType() { - return expectedResponseType; + return this.expectedResponseType; } public void setExpectedResponseType(Class expectedResponseType) { @@ -113,7 +113,7 @@ public void setTimeout(long timeout) { } public Expression getBodyExpression() { - return bodyExpression; + return this.bodyExpression; } public void setBodyExpression(Expression bodyExpression) { @@ -121,7 +121,7 @@ public void setBodyExpression(Expression bodyExpression) { } public Expression getHeadersExpression() { - return headersExpression; + return this.headersExpression; } public void setHeadersExpression(Expression headersExpression) { @@ -130,7 +130,7 @@ public void setHeadersExpression(Expression headersExpression) { @NotNull public Expression getReplyExpression() { - return replyExpression; + return this.replyExpression; } public void setReplyExpression(Expression replyExpression) { diff --git a/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/package-info.java b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/package-info.java new file mode 100644 index 00000000..8de3f840 --- /dev/null +++ b/function/spring-http-request-function/src/main/java/org/springframework/cloud/fn/http/request/package-info.java @@ -0,0 +1,4 @@ +/** + * The HTTP function auto-configuration. + */ +package org.springframework.cloud.fn.http.request; diff --git a/function/spring-http-request-function/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/function/spring-http-request-function/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..62e37403 --- /dev/null +++ b/function/spring-http-request-function/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.cloud.fn.http.request.HttpRequestFunctionConfiguration diff --git a/function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTestApplicationTests.java b/function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTests.java similarity index 88% rename from function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTestApplicationTests.java rename to function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTests.java index 307e0861..f15da8a9 100644 --- a/function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTestApplicationTests.java +++ b/function/spring-http-request-function/src/test/java/org/springframework/cloud/fn/http/request/HttpRequestFunctionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,11 +40,11 @@ import org.springframework.messaging.support.MessageBuilder; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -public class HttpRequestFunctionTestApplicationTests { +public class HttpRequestFunctionTests { - private MockWebServer server = new MockWebServer(); + private final MockWebServer server = new MockWebServer(); private ApplicationContextRunner runner; @@ -56,13 +56,12 @@ void setup() { @Test void shouldReturnString() { - server.enqueue(new MockResponse().setResponseCode(HttpStatus.OK.value()).setBody("hello")); - runner.withPropertyValues("http.request.http-method-expression='POST'").run(context -> { + runner.withPropertyValues("http.request.http-method-expression='POST'").run((context) -> { HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); Message message = MessageBuilder.withPayload("").build(); - ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); assertThat(r.getBody()).isEqualTo("hello"); assertThat(r.getStatusCode().is2xxSuccessful()).isTrue(); }); @@ -70,7 +69,6 @@ void shouldReturnString() { @Test void shouldPostJson() { - server.setDispatcher(new Dispatcher() { @Override public MockResponse dispatch(RecordedRequest recordedRequest) { @@ -84,11 +82,11 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { runner .withPropertyValues("http.request.http-method-expression='POST'", "http.request.headers-expression={'Content-Type':'application/json'}") - .run(context -> { + .run((context) -> { HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); String json = "{\"hello\":\"world\"}"; Message message = MessageBuilder.withPayload(json).build(); - ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); assertThat(r.getBody()).isEqualTo(json); assertThat(r.getStatusCode().is2xxSuccessful()).isTrue(); assertThat(r.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_JSON); @@ -113,11 +111,11 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { runner .withPropertyValues("http.request.http-method-expression='POST'", "http.request.expected-response-type=" + Map.class.getName()) - .run(context -> { + .run((context) -> { HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); Map json = Collections.singletonMap("hello", "world"); Message message = MessageBuilder.withPayload(json).build(); - ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); assertThat(r.getBody()).isEqualTo(json); assertThat(r.getStatusCode().is2xxSuccessful()).isTrue(); assertThat(r.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_JSON); @@ -141,10 +139,10 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { runner .withPropertyValues("http.request.http-method-expression='DELETE'", "http.request.expected-response-type=" + Void.class.getName()) - .run(context -> { + .run((context) -> { HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); Message message = MessageBuilder.withPayload("").build(); - ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity r = (ResponseEntity) httpRequestFunction.apply(message); assertThat(r.getBody()).isNull(); assertThat(r.getStatusCode().is2xxSuccessful()).isTrue(); RecordedRequest request = server.takeRequest(100, TimeUnit.MILLISECONDS); @@ -155,15 +153,11 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { @Test void shouldThrowErrorIfCannotConnect() throws IOException { server.shutdown(); - runner.run(context -> { + runner.run((context) -> { HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); - try { - httpRequestFunction.apply(new GenericMessage("")); - fail("Expected exception"); - } - catch (Throwable throwable) { - assertThat(throwable.getMessage()).contains("Connection refused"); - } + assertThatExceptionOfType(Throwable.class) + .isThrownBy(() -> httpRequestFunction.apply(new GenericMessage<>(""))) + .withMessageContaining("Connection refused"); }); } @@ -182,7 +176,7 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { runner.withPropertyValues("http.request.url-expression=headers['url']", "http.request.http-method-expression=headers['method']", "http.request.body-expression=headers['body']", "http.request.headers-expression={Accept:'application/json'}") - .run(context -> { + .run((context) -> { Message message = MessageBuilder.withPayload("") .setHeader("url", url()) .setHeader("method", "POST") @@ -190,7 +184,7 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { .build(); HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); - ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody()).isEqualTo(message.getHeaders().get("body")); assertThat(responseEntity.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_JSON); @@ -212,10 +206,10 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { .withPropertyValues("http.request..http-method-expression='POST'", "http.request.headers-expression={'Content-Type':'application/octet-stream'}", "http.request.expected-response-type=byte[]") - .run(context -> { + .run((context) -> { Message message = MessageBuilder.withPayload("hello").build(); HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); - ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody()).isEqualTo("hello".getBytes()); assertThat(responseEntity.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); @@ -233,11 +227,11 @@ public MockResponse dispatch(RecordedRequest recordedRequest) { } }); runner.withPropertyValues("http.request.http-method-expression=#jsonPath(payload,'$.myMethod')") - .run(context -> { + .run((context) -> { Message message = MessageBuilder.withPayload("{\"name\":\"Fred\",\"age\":41, \"myMethod\":\"POST\"}") .build(); HttpRequestFunction httpRequestFunction = context.getBean(HttpRequestFunction.class); - ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); + ResponseEntity responseEntity = (ResponseEntity) httpRequestFunction.apply(message); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody()).isEqualTo(message.getPayload()); }); diff --git a/supplier/spring-http-supplier/README.adoc b/supplier/spring-http-supplier/README.adoc index 9725e100..b53fca50 100644 --- a/supplier/spring-http-supplier/README.adoc +++ b/supplier/spring-http-supplier/README.adoc @@ -8,7 +8,7 @@ Users have to subscribe to this `Flux` and then receive the data. ## Beans for injection -You can import the `HttpSupplierConfiguration` in the application and then inject the following bean. +The `HttpSupplierConfiguration` auto-configuration provides the following bean: `httpSupplier` diff --git a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java index d9c10051..77978dbc 100644 --- a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java +++ b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2023 the original author or authors. + * Copyright 2011-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,11 @@ import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -39,12 +40,12 @@ import org.springframework.messaging.MessageHeaders; /** - * Configuration for the HTTP Supplier. + * The auto-configuration for the HTTP Supplier. * * @author Artem Bilan */ @EnableConfigurationProperties(HttpSupplierProperties.class) -@Configuration +@AutoConfiguration(after = WebFluxAutoConfiguration.class) public class HttpSupplierConfiguration { @Bean @@ -65,7 +66,7 @@ public Publisher> httpSupplierFlow(HttpSupplierProperties httpSu .statusCodeExpression(new ValueExpression<>(HttpStatus.ACCEPTED)) .headerMapper(httpHeaderMapper) .codecConfigurer(serverCodecConfigurer) - .crossOrigin(crossOrigin -> crossOrigin.origin(httpSupplierProperties.getCors().getAllowedOrigins()) + .crossOrigin((crossOrigin) -> crossOrigin.origin(httpSupplierProperties.getCors().getAllowedOrigins()) .allowedHeaders(httpSupplierProperties.getCors().getAllowedHeaders()) .allowCredentials(httpSupplierProperties.getCors().getAllowCredentials())) .autoStartup(false)) diff --git a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierProperties.java b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierProperties.java index 5414704d..e691118b 100644 --- a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierProperties.java +++ b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/HttpSupplierProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ * * @author Artem Bilan */ -@ConfigurationProperties("http") +@ConfigurationProperties("http.supplier") @Validated public class HttpSupplierProperties { @@ -109,7 +109,7 @@ public void setAllowedHeaders(String[] allowedHeaders) { } public Boolean getAllowCredentials() { - return allowCredentials; + return this.allowCredentials; } public void setAllowCredentials(Boolean allowCredentials) { diff --git a/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/package-info.java b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/package-info.java new file mode 100644 index 00000000..efc712f6 --- /dev/null +++ b/supplier/spring-http-supplier/src/main/java/org/springframework/cloud/fn/supplier/http/package-info.java @@ -0,0 +1,4 @@ +/** + * The HTTP supplier auto-configuration. + */ +package org.springframework.cloud.fn.supplier.http; diff --git a/supplier/spring-http-supplier/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/supplier/spring-http-supplier/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..a33a838d --- /dev/null +++ b/supplier/spring-http-supplier/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.cloud.fn.supplier.http.HttpSupplierConfiguration diff --git a/supplier/spring-http-supplier/src/main/resources/application.properties b/supplier/spring-http-supplier/src/main/resources/application.properties deleted file mode 100644 index 8b137891..00000000 --- a/supplier/spring-http-supplier/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/supplier/spring-http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java b/supplier/spring-http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java index b2279408..13ce1dad 100644 --- a/supplier/spring-http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java +++ b/supplier/spring-http-supplier/src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,7 +112,7 @@ public void testHttpSupplier() throws SSLException { .trustManager(InsecureTrustManagerFactory.INSTANCE) .build(); - HttpClient httpClient = HttpClient.create().secure(sslSpec -> sslSpec.sslContext(sslContext)); + HttpClient httpClient = HttpClient.create().secure((sslSpec) -> sslSpec.sslContext(sslContext)); WebClient webClient = WebClient.builder() .clientConnector(new ReactorClientHttpConnector(httpClient)) @@ -140,24 +140,7 @@ public void testHttpSupplier() throws SSLException { stepVerifier.verify(); } - private static class TestPojo { - - private String name; - - TestPojo() { - } - - TestPojo(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } + private record TestPojo(String name) { }