Skip to content

Commit

Permalink
Spring 3 and Java 17 migration (#41)
Browse files Browse the repository at this point in the history
* update versions

* replace javax with jakarta

* replace SocketUtils with TestSocketUtils

* refactor SecurityConfig without WebSecurityConfigurerAdapter

* update comments in gradle.properties

* update workflow java version

* adjust GzipCompressionMethodIntTest

* change download location for OpenTelemetryPlugin
  • Loading branch information
EddeCCC authored Jun 21, 2023
1 parent 9ebcb9e commit 7834c07
Show file tree
Hide file tree
Showing 50 changed files with 144 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/eumserver_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
container: openjdk:8-jdk
container: openjdk:17-jdk-slim
steps:
- uses: actions/checkout@v3
- name: Grant execute permission for gradlew
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ apply plugin: "java"
apply plugin: "jacoco"

group = "rocks.inspectit.ocelot"
sourceCompatibility = "1.8"
sourceCompatibility = "17"
targetCompatibility = "17"

if (!project.hasProperty("buildVersion") || project.getProperty("buildVersion").empty) {
ext.buildVersion = "SNAPSHOT"
Expand Down Expand Up @@ -55,7 +56,7 @@ tasks.register('generateVersionFile') {
}

tasks.register('downloadOpenTelemetryPlugin') {
ext.dest = new File(buildDir, "boomerang-opentelemetry.js")
ext.dest = new File(buildDir, "boomerangjs-${boomerangVersion}/package/plugins/boomerang-opentelemetry.js")
outputs.files(ext.dest)
doLast {
def f = ext.dest
Expand Down Expand Up @@ -158,7 +159,7 @@ dependencies {
testImplementation(
"org.springframework.boot:spring-boot-starter-test",
"io.opencensus:opencensus-impl:${openCensusVersion}",
"org.apache.httpcomponents:httpclient",
"org.apache.httpcomponents:httpclient:4.5.14",
"org.mockito:mockito-core",
"org.junit.jupiter:junit-jupiter-api",
"org.awaitility:awaitility",
Expand Down
23 changes: 8 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@
boomerangVersion=1.737.0
# The open-telemetry-boomerang version to ship with the EUM server
boomerangOpenTelemetryPluginVersion=0.25.0-6
# 2.7 is the latest release line which runs on Java 8
springBootVersion=2.7.11
# We do not really use snakeyaml directly. We overwrite the version of
# spring due to a security report
# For 1.33 CVE-2022-1471 is still identified. Since EUM-Server
# does not read yaml from untrusted sources, it is not affected.
# We cannot use 2.0 because EUM-Server actually parses a YAML file via Jackson.
# Jackson uses SnakeYaml and cannot deal with version 2.0
snakeYamlVersion=1.33
# Upgrade to Spring 3.* and Java 17
springBootVersion=3.1.0
# CVE-2022-1471 was resolved with SnakeYAML 2.0
snakeYamlVersion=2.0
# Ensure to adapt the netty version (inspectit-ocelot-core/build.gradle) when changing the OpenCensus version
openCensusVersion=0.31.1
# pin Prometheus client to 0.6.0 to prevent auto prefixing counter metrics with "_total"
# see: https://github.com/prometheus/client_java/issues/640, https://github.com/prometheus/client_java/pull/653
prometheusClientVersion = 0.6.0
openTelemetryVersion=1.25.0
openTelemetryAlphaVersion=1.25.0-alpha
openTelemetryVersion=1.27.0
openTelemetryAlphaVersion=1.27.0-alpha
openTelemetryProtoVersion=1.7.1-alpha
protobufVersion=3.22.3
guavaVersion=31.1-jre
# there are newer version, but they are not compatible with Java 8
geoip2Version=2.16.1
geoip2Version=4.0.1
commonsNetVersion=3.9.0
commonsMath3Version=3.6.1
commonsIoVersion=2.11.0
Expand All @@ -40,5 +34,4 @@ owaspDependencyCheckVersion=8.2.1
# org.cyclonedx.bom
cyclonedxBomVersion=1.7.4
# com.palantir.docker
# There is a newer Version 0.35.0, but it is not Java 8 compatible
palantirDockerVersion=0.34.0
palantirDockerVersion=0.35.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import rocks.inspectit.oce.eum.server.beacon.Beacon;
import rocks.inspectit.oce.eum.server.utils.RequestUtils;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.Map;
import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import rocks.inspectit.oce.eum.server.configuration.model.metric.definition.ViewDefinitionSettings;
import rocks.inspectit.oce.eum.server.metrics.MeasuresAndViewsManager;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;
import java.io.IOException;
import java.util.*;
import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.ConversionService;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import rocks.inspectit.oce.eum.server.configuration.conversion.InspectitConfigConversionService;

import java.util.concurrent.Executors;
Expand Down Expand Up @@ -45,4 +47,9 @@ public ScheduledExecutorService scheduledExecutor() {
public ConversionService getConversionService() {
return InspectitConfigConversionService.getInstance();
}

@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
return config.getAuthenticationManager();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import rocks.inspectit.oce.eum.server.configuration.model.selfmonitoring.SelfMonitoringSettings;
import rocks.inspectit.oce.eum.server.configuration.model.tags.TagsSettings;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import rocks.inspectit.oce.eum.server.configuration.model.exporters.metrics.MetricsExportersSettings;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.trace.TraceExportersSettings;

import javax.validation.Valid;
import jakarta.validation.Valid;

/**
* Extended exporter settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import jakarta.validation.Valid;

/**
* Beacon exporter settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import org.springframework.validation.annotation.Validated;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.Duration;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.hibernate.validator.constraints.time.DurationMin;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import java.time.Duration;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import jakarta.validation.Valid;

/**
* Settings for metrics exporters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.TransportProtocol;

import javax.annotation.PostConstruct;
import java.time.Duration;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import lombok.NoArgsConstructor;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.ExporterEnabledState;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;

/**
* Settings for the OpenCensus Prometheus metrics exporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import jakarta.validation.Valid;

@Data
@Validated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import rocks.inspectit.oce.eum.server.arithmetic.RawExpression;
import rocks.inspectit.oce.eum.server.beacon.Beacon;

import javax.validation.Valid;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import rocks.inspectit.oce.eum.server.beacon.Beacon;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.beacon.InitiatorType;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import lombok.*;
import org.springframework.util.CollectionUtils;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.Duration;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.hibernate.validator.constraints.time.DurationMin;
import org.springframework.util.CollectionUtils;

import javax.validation.constraints.*;
import jakarta.validation.constraints.*;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.springframework.validation.annotation.Validated;
import rocks.inspectit.oce.eum.server.configuration.model.security.authProvider.AuthenticationProviderSettings;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import jakarta.validation.Valid;

@Data
@Validated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.AssertTrue;
import jakarta.validation.constraints.AssertTrue;
import java.time.Duration;

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.springframework.validation.annotation.Validated;
import rocks.inspectit.oce.eum.server.configuration.model.metric.definition.MetricDefinitionSettings;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import rocks.inspectit.oce.eum.server.configuration.model.tags.providers.TagsProvidersSettings;
import rocks.inspectit.oce.eum.server.utils.IPUtils;

import javax.validation.Valid;
import javax.validation.constraints.AssertFalse;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.Pattern;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertFalse;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Pattern;
import java.util.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import jakarta.validation.Valid;

@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import rocks.inspectit.oce.eum.server.metrics.percentiles.TimeWindowViewManager;
import rocks.inspectit.opencensus.influx.InfluxExporter;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@
import rocks.inspectit.oce.eum.server.configuration.model.exporters.TransportProtocol;
import rocks.inspectit.oce.eum.server.configuration.model.exporters.metrics.OtlpMetricsExporterSettings;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.validation.Valid;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.springframework.stereotype.Component;
import rocks.inspectit.oce.eum.server.configuration.model.EumServerConfiguration;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;

/**
* Service for the Prometheus OpenCensus exporters.
Expand Down
Loading

0 comments on commit 7834c07

Please sign in to comment.