Updates to version 4.0.0-SNAPSHOT

Updates to java 17, framework 6, boot 3 and javax -> jakarta
This commit is contained in:
spencergibb
2022-01-04 15:42:45 -05:00
parent 32ab43685f
commit c1c4cfb7b8
37 changed files with 133 additions and 116 deletions

View File

@@ -1,3 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=8.0.292.hs-adpt
java=17.0.1-tem

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>spring-cloud-gateway-docs</artifactId>
<packaging>jar</packaging>

10
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Cloud Gateway</name>
@@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath/>
</parent>
<scm>
@@ -52,10 +52,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<blockhound.version>1.0.6.RELEASE</blockhound.version>
<java.version>1.8</java.version>
<java.version>17</java.version>
<junit-pioneer.version>1.0.0</junit-pioneer.version>
<spring-cloud-circuitbreaker.version>2.1.1-SNAPSHOT</spring-cloud-circuitbreaker.version>
<spring-cloud-commons.version>3.1.1-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-circuitbreaker.version>3.0.0-SNAPSHOT</spring-cloud-circuitbreaker.version>
<spring-cloud-commons.version>4.0.0-SNAPSHOT</spring-cloud-commons.version>
<testcontainers.version>1.15.1</testcontainers.version>
</properties>

View File

@@ -6,12 +6,12 @@
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>3.1.0</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-gateway-dependencies</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-cloud-gateway-dependencies</name>

View File

@@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway-integration-tests</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
@@ -49,6 +49,12 @@
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope> <!-- not needed at runtime -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway-integration-tests</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>

View File

@@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway-integration-tests</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>

View File

@@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

View File

@@ -36,14 +36,14 @@ import java.util.Vector;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.WriteListener;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponseWrapper;
import org.springframework.core.Conventions;
import org.springframework.core.MethodParameter;

View File

@@ -22,7 +22,7 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.gateway.mvc.ProxyExchange;
import org.springframework.core.MethodParameter;

View File

@@ -71,26 +71,32 @@ public class GetWithBodyRequestClientHttpRequestFactory implements ClientHttpReq
}
private HttpUriRequest createHttpUriRequest(final HttpMethod httpMethod, final URI uri) {
switch (httpMethod) {
case GET:
if (httpMethod.equals(HttpMethod.GET)) {
return new GetWithEntity(uri);
case HEAD:
return new HttpHead(uri);
case POST:
return new HttpPost(uri);
case PUT:
return new HttpPut(uri);
case PATCH:
return new HttpPatch(uri);
case DELETE:
return new HttpDelete(uri);
case OPTIONS:
return new HttpOptions(uri);
case TRACE:
return new HttpTrace(uri);
default:
throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
}
else if (httpMethod.equals(HttpMethod.HEAD)) {
return new HttpHead(uri);
}
else if (httpMethod.equals(HttpMethod.OPTIONS)) {
return new HttpOptions(uri);
}
else if (httpMethod.equals(HttpMethod.POST)) {
return new HttpPost(uri);
}
else if (httpMethod.equals(HttpMethod.DELETE)) {
return new HttpDelete(uri);
}
else if (httpMethod.equals(HttpMethod.PUT)) {
return new HttpPut(uri);
}
else if (httpMethod.equals(HttpMethod.PATCH)) {
return new HttpPatch(uri);
}
else if (httpMethod.equals(HttpMethod.TRACE)) {
return new HttpTrace(uri);
}
throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
}
private RequestConfig createRequestConfig(final HttpClient client) {

View File

@@ -28,6 +28,7 @@ import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.protocol.HttpContext;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.util.StringUtils;
@@ -52,6 +53,11 @@ final class HttpComponentsClientHttpRequest extends AbstractBufferingClientHttpR
this.httpContext = httpContext;
}
@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(httpRequest.getMethod());
}
@Override
public String getMethodValue() {
return httpRequest.getMethod();

View File

@@ -16,7 +16,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-gateway-server</artifactId>

View File

@@ -19,7 +19,7 @@ package org.springframework.cloud.gateway.config;
import java.util.HashMap;
import java.util.Map;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.style.ToStringCreator;

View File

@@ -20,9 +20,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -31,8 +31,8 @@ import java.util.Collection;
import java.util.List;
import javax.net.ssl.KeyManagerFactory;
import javax.validation.constraints.Max;
import jakarta.validation.constraints.Max;
import reactor.netty.resources.ConnectionProvider;
import reactor.netty.tcp.SslProvider;
import reactor.netty.transport.ProxyProvider;

View File

@@ -16,9 +16,9 @@
package org.springframework.cloud.gateway.config;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.Max;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import jakarta.validation.constraints.Max;
import org.springframework.util.unit.DataSize;

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.gateway.config;
import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;

View File

@@ -20,7 +20,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.gateway.support.NameUtils;
import org.springframework.validation.annotation.Validated;

View File

@@ -120,14 +120,7 @@ public class WebClientHttpRoutingFilter implements GlobalFilter, Ordered {
}
private boolean requiresBody(HttpMethod method) {
switch (method) {
case PUT:
case POST:
case PATCH:
return true;
default:
return false;
}
return method.equals(HttpMethod.PUT) || method.equals(HttpMethod.POST) || method.equals(HttpMethod.PATCH);
}
}

View File

@@ -19,7 +19,7 @@ package org.springframework.cloud.gateway.filter.factory;
import java.util.Arrays;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.core.style.ToStringCreator;

View File

@@ -23,8 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.validation.constraints.Min;
import jakarta.validation.constraints.Min;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.springframework.web.server.ServerWebExchange;

View File

@@ -21,7 +21,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;

View File

@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.http.HttpCookie;
import org.springframework.validation.annotation.Validated;

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;

View File

@@ -20,8 +20,8 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import javax.validation.ValidationException;
import javax.validation.constraints.NotNull;
import jakarta.validation.ValidationException;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.gateway.support.NameUtils;
import org.springframework.validation.annotation.Validated;

View File

@@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;

View File

@@ -23,11 +23,10 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import io.netty.handler.ipfilter.IpFilterRuleType;
import io.netty.handler.ipfilter.IpSubnetFilterRule;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -23,10 +23,10 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.validation.Valid;
import javax.validation.ValidationException;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.ValidationException;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.gateway.filter.FilterDefinition;
import org.springframework.cloud.gateway.handler.predicate.PredicateDefinition;

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.gateway.support;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.core.style.ToStringCreator;
import org.springframework.validation.annotation.Validated;

View File

@@ -19,8 +19,7 @@ package org.springframework.cloud.gateway.support;
import java.util.Collections;
import java.util.Map;
import javax.validation.constraints.Max;
import jakarta.validation.constraints.Max;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

View File

@@ -305,45 +305,55 @@ public class ProxyExchange<T> {
}
public Mono<ResponseEntity<T>> forward() {
switch (httpMethod) {
case GET:
if (httpMethod.equals(HttpMethod.GET)) {
return get();
case HEAD:
return head();
case OPTIONS:
return options();
case POST:
return post();
case DELETE:
return delete();
case PUT:
return put();
case PATCH:
return patch();
default:
return Mono.empty();
}
else if (httpMethod.equals(HttpMethod.HEAD)) {
return head();
}
else if (httpMethod.equals(HttpMethod.OPTIONS)) {
return options();
}
else if (httpMethod.equals(HttpMethod.POST)) {
return post();
}
else if (httpMethod.equals(HttpMethod.DELETE)) {
return delete();
}
else if (httpMethod.equals(HttpMethod.PUT)) {
return put();
}
else if (httpMethod.equals(HttpMethod.PATCH)) {
return patch();
}
return Mono.empty();
}
public <S> Mono<ResponseEntity<S>> forward(Function<ResponseEntity<T>, ResponseEntity<S>> converter) {
switch (httpMethod) {
case GET:
if (httpMethod.equals(HttpMethod.GET)) {
return get(converter);
case HEAD:
return head(converter);
case OPTIONS:
return options(converter);
case POST:
return post(converter);
case DELETE:
return delete(converter);
case PUT:
return put(converter);
case PATCH:
return patch(converter);
default:
return Mono.empty();
}
else if (httpMethod.equals(HttpMethod.HEAD)) {
return head(converter);
}
else if (httpMethod.equals(HttpMethod.OPTIONS)) {
return options(converter);
}
else if (httpMethod.equals(HttpMethod.POST)) {
return post(converter);
}
else if (httpMethod.equals(HttpMethod.DELETE)) {
return delete(converter);
}
else if (httpMethod.equals(HttpMethod.PUT)) {
return put(converter);
}
else if (httpMethod.equals(HttpMethod.PATCH)) {
return patch(converter);
}
return Mono.empty();
}
private Mono<ResponseEntity<T>> exchange(RequestEntity<?> requestEntity) {

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gateway</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <!-- lookup parent from repository -->
</parent>
<artifactId>spring-cloud-starter-gateway</artifactId>