Skip to content

Commit

Permalink
Upgrade spring boot to 3.2.1 (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrrzysko authored Jan 16, 2024
1 parent 17d5b40 commit 93fc277
Show file tree
Hide file tree
Showing 32 changed files with 89 additions and 80 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ allprojects {
guava : '23.0',
jackson : '2.15.2',
jersey : '3.1.2',
jetty : '11.0.15',
jetty : '12.0.5',
curator : '5.4.0',
dropwizard_metrics: '4.1.0',
micrometer_metrics: '1.11.1',
wiremock : '3.0.1',
wiremock : '3.3.1',
spock : '2.4-M1-groovy-4.0',
groovy : '4.0.12',
avro : '1.9.1',
json2avro : '0.2.14',
okhttp : '3.9.1',
undertow : '2.0.29.Final',
spring_web : '6.0.8',
spring_web : '6.1.2',
failsafe : '2.3.1',
junit_jupiter : '5.8.2',
testcontainers : '1.18.1',
spring : '3.0.6',
spring : '3.2.1',
assertj : '3.22.0'
]

Expand Down
1 change: 1 addition & 0 deletions hermes-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
testImplementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: versions.jersey
testImplementation group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: versions.jersey
testImplementation group: 'org.springframework', name: 'spring-web', version: versions.spring_web
testImplementation group: 'org.springframework', name: 'spring-context', version: versions.spring_web
testImplementation group: 'org.springframework', name: 'spring-webflux', version: versions.spring_web
testImplementation group: 'com.squareup.okhttp3', name: 'okhttp', version: versions.okhttp
testImplementation group: 'io.projectreactor.netty', name: 'reactor-netty', version: '1.0.25'
Expand Down
2 changes: 1 addition & 1 deletion hermes-consumers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {

api group: 'org.springframework.boot', name: 'spring-boot-starter', version: versions.spring
api group: 'org.eclipse.jetty', name: 'jetty-alpn-java-client', version: versions.jetty
api group: 'org.eclipse.jetty.http2', name: 'http2-http-client-transport', version: versions.jetty
api group: 'org.eclipse.jetty.http2', name: 'jetty-http2-client-transport', version: versions.jetty

implementation group: 'org.jctools', name: 'jctools-core', version: '1.2'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.google.common.collect.ImmutableSet;
import jakarta.inject.Named;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.entity.ContentType;
import org.eclipse.jetty.client.ContentResponse;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpStatus;
Expand Down Expand Up @@ -40,21 +40,28 @@ private Request createHttpRequest(OAuthTokenRequest request) {
.timeout(request.getRequestTimeout(), TimeUnit.MILLISECONDS)
.idleTimeout(request.getSocketTimeout(), TimeUnit.MILLISECONDS)
.method(HttpMethod.POST)
.header(HttpHeader.KEEP_ALIVE, "true")
.header(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString())
.param(OAuthTokenRequest.Param.GRANT_TYPE, request.getGrantType())
.param(OAuthTokenRequest.Param.SCOPE, request.getScope())
.param(OAuthTokenRequest.Param.CLIENT_ID, request.getClientId())
.param(OAuthTokenRequest.Param.CLIENT_SECRET, request.getClientSecret());
.headers(headers -> {
headers.add(HttpHeader.KEEP_ALIVE, "true");
headers.add(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString());
});
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.GRANT_TYPE, request.getGrantType());
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.SCOPE, request.getScope());
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.CLIENT_ID, request.getClientId());
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.CLIENT_SECRET, request.getClientSecret());

if (OAuthTokenRequest.GrantTypeValue.RESOURCE_OWNER_USERNAME_PASSWORD.equals(request.getGrantType())) {
httpRequest
.param(OAuthTokenRequest.Param.USERNAME, request.getUsername())
.param(OAuthTokenRequest.Param.PASSWORD, request.getPassword());
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.USERNAME, request.getUsername());
addParamIfNotNull(httpRequest, OAuthTokenRequest.Param.PASSWORD, request.getPassword());
}
return httpRequest;
}

private void addParamIfNotNull(Request request, String name, String value) {
if (value != null) {
request.param(name, value);
}
}

private ContentResponse performHttpRequest(OAuthTokenRequest request) {
try {
return createHttpRequest(request).send();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.allegro.tech.hermes.consumers.consumer.sender;

import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.Result;
import pl.allegro.tech.hermes.consumers.consumer.sender.resolver.EndpointAddressResolutionException;

import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import jakarta.ws.rs.core.Response;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.Result;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeader;
import pl.allegro.tech.hermes.common.exception.InternalProcessingException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.consumers.consumer.batch.MessageBatch;
import pl.allegro.tech.hermes.consumers.consumer.sender.http.headers.HttpRequestHeaders;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.ByteBufferRequestContent;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.http.HttpMethod;
import pl.allegro.tech.hermes.common.exception.InternalProcessingException;
import pl.allegro.tech.hermes.consumers.consumer.batch.MessageBatch;
Expand All @@ -19,16 +19,11 @@ public DefaultBatchHttpRequestFactory(HttpClient client) {
}

public Request buildRequest(MessageBatch message, URI uri, HttpRequestHeaders headers, int requestTimeout) {
Request request = client.newRequest(uri)
return client.newRequest(uri)
.method(HttpMethod.POST)
.timeout(requestTimeout, TimeUnit.MILLISECONDS)
.content(new ByteBufferContentProvider(message.getContent()));


headers.asMap()
.forEach(request::header);

return request;
.body(new ByteBufferRequestContent(message.getContent()))
.headers(httpHeaders -> headers.asMap().forEach(httpHeaders::add));
}

private static HttpClient started(HttpClient httpClient) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.trace.MetadataAppender;

public class DefaultHttpMetadataAppender implements MetadataAppender<Request> {

@Override
public Request append(Request target, Message message) {
message.getExternalMetadata().forEach(target::header);
target.headers(httpFields -> message.getExternalMetadata().forEach(httpFields::add));
return target;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.BytesRequestContent;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.BytesContentProvider;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.http.HttpMethod;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.sender.http.headers.HttpRequestHeaders;
Expand Down Expand Up @@ -46,20 +46,16 @@ private class HttpRequestBuilder {
}

Request build() {
Request request = baseRequest();

headers.asMap()
.forEach(request::header);

return request;
return baseRequest()
.headers(httpHeaders -> headers.asMap().forEach(httpHeaders::add));
}

private Request baseRequest() {
Request baseRequest = client.newRequest(uri)
.method(HttpMethod.POST)
.timeout(timeout, TimeUnit.MILLISECONDS)
.idleTimeout(socketTimeout, TimeUnit.MILLISECONDS)
.content(new BytesContentProvider(message.getData()));
.body(new BytesRequestContent(message.getData()));

metadataAppender.append(baseRequest, message);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.consumers.consumer.trace.MetadataAppender;

Expand All @@ -19,6 +19,4 @@ public HttpRequestFactory provideRequestFactory(Subscription subscription,
metadataAppender
);
}


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Response;
import org.eclipse.jetty.client.ContentResponse;
import org.eclipse.jetty.client.Response;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;
import pl.allegro.tech.hermes.consumers.consumer.sender.SingleMessageSendingResult;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP;
import org.eclipse.jetty.client.transport.HttpClientTransportOverHTTP;
import org.eclipse.jetty.http.HttpCookieStore;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.io.ClientConnector;
import org.eclipse.jetty.util.HttpCookieStore;
import pl.allegro.tech.hermes.common.metric.executor.InstrumentedExecutorServiceFactory;

import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -36,7 +36,7 @@ public HttpClient createClientForHttp1(String name, Http1ClientParameters http1C
client.setExecutor(executor);
client.setMaxConnectionsPerDestination(http1ClientParameters.getMaxConnectionsPerDestination());
client.setMaxRequestsQueuedPerDestination(http1ClientParameters.getMaxRequestsQueuedPerDestination());
client.setCookieStore(new HttpCookieStore.Empty());
client.setHttpCookieStore(new HttpCookieStore.Empty());
client.setIdleTimeout(http1ClientParameters.getIdleTimeout().toMillis());
client.setFollowRedirects(http1ClientParameters.isFollowRedirectsEnabled());
client.setConnectTimeout(http1ClientParameters.getConnectionTimeout().toMillis());
Expand All @@ -62,7 +62,7 @@ public HttpClient createClientForHttp2(String name, Http2ClientParameters http2C
HttpClient client = new HttpClient(transport);

client.setMaxRequestsQueuedPerDestination(http2ClientParameters.getMaxRequestsQueuedPerDestination());
client.setCookieStore(new HttpCookieStore.Empty());
client.setHttpCookieStore(new HttpCookieStore.Empty());
client.setIdleTimeout(http2ClientParameters.getIdleTimeout().toMillis());
client.setFollowRedirects(http2ClientParameters.isFollowRedirectsEnabled());
client.setConnectTimeout(http2ClientParameters.getConnectionTimeout().toMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.eclipse.jetty.client.ConnectionPool;
import org.eclipse.jetty.client.DuplexConnectionPool;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpDestination;
import org.eclipse.jetty.client.MultiplexConnectionPool;
import org.eclipse.jetty.client.transport.HttpDestination;
import pl.allegro.tech.hermes.common.metric.MetricsFacade;

import java.util.Queue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.sender.http.headers.HttpRequestHeaders;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.consumers.consumer.trace.MetadataAppender;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import com.google.common.collect.ImmutableList;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.ResilientMessageSender;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSender;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.BufferingResponseListener;
import org.eclipse.jetty.client.BufferingResponseListener;
import org.eclipse.jetty.client.Result;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;
import pl.allegro.tech.hermes.consumers.consumer.sender.SingleMessageSendingResult;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.common.collect.ImmutableSet;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.allegro.tech.hermes.api.EndpointAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import org.apache.http.entity.ContentType;
import org.apache.http.protocol.HTTP;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.ContentResponse;
import org.eclipse.jetty.client.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.allegro.tech.hermes.api.EndpointAddress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.Request;
import pl.allegro.tech.hermes.consumers.consumer.Message;
import pl.allegro.tech.hermes.consumers.consumer.sender.CompletableFutureAwareMessageSender;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.BufferingResponseListener;
import org.eclipse.jetty.client.BufferingResponseListener;
import org.eclipse.jetty.client.Result;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;

import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http;

import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Response.CompleteListener;
import org.eclipse.jetty.client.ContentResponse;
import org.eclipse.jetty.client.Response.CompleteListener;
import pl.allegro.tech.hermes.consumers.consumer.sender.MessageSendingResult;
import pl.allegro.tech.hermes.consumers.consumer.sender.SingleMessageSendingResult;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.allegro.tech.hermes.consumers.consumer.sender.http

import org.eclipse.jetty.client.HttpClient
import org.eclipse.jetty.client.HttpDestination
import org.eclipse.jetty.client.HttpExchange
import org.eclipse.jetty.client.transport.HttpDestination
import org.eclipse.jetty.client.transport.HttpExchange
import pl.allegro.tech.hermes.common.metric.MetricsFacade
import spock.lang.Specification

Expand Down
Loading

0 comments on commit 93fc277

Please sign in to comment.