From 6a6f1f5dffbb029972d119fd9d1b6c823d12cf8e Mon Sep 17 00:00:00 2001 From: pz2 Date: Wed, 19 Jun 2024 07:56:43 +0200 Subject: [PATCH 1/4] Spring Boot 3.3 and Java 17 --- README.md | 7 ++++--- .../connection/HofundConnectionMeter.java | 2 +- .../hofund/git/HofundGitInfoMeter.java | 2 +- .../hofund/graph/edge/HofundEdgeMeter.java | 2 +- .../hofund/graph/node/HofundNodeMeter.java | 2 +- .../logchange/hofund/info/HofundInfoMeter.java | 2 +- .../hofund/java/HofundJavaInfoMeter.java | 2 +- .../logchange/hofund/os/HofundOsInfoMeter.java | 3 +-- .../hofund/web/HofundWebServerInfoMeter.java | 2 +- hofund-spring-boot-autoconfigure/pom.xml | 7 +++++++ .../HofundConnectionAutoConfiguration.java | 6 ++---- .../HofundGitInfoAutoConfiguration.java | 7 ++----- .../HofundGraphAutoConfiguration.java | 7 ++----- .../HofundInfoAutoConfiguration.java | 7 ++----- .../HofundJavaInfoAutoConfiguration.java | 8 ++------ .../HofundOsInfoAutoConfiguration.java | 11 ++--------- .../HofundWebServerInfoAutoConfiguration.java | 6 ++---- .../main/resources/META-INF/spring.factories | 9 --------- hofund-spring-boot-e2e/pom.xml | 2 +- .../git/HofundDefaultGitInfoE2ETest.java | 2 +- .../hofund/git/HofundGitInfoE2ETest.java | 2 +- .../hofund/info/HofundInfoE2ETest.java | 2 +- .../hofund/java/HofundJavaInfoE2ETest.java | 2 +- .../hofund/os/HofundOsInfoE2ETest.java | 2 +- .../hofund/web/HofundWebServerInfoE2ETest.java | 6 +++--- pom.xml | 18 +++++++++--------- 26 files changed, 51 insertions(+), 77 deletions(-) delete mode 100644 hofund-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories diff --git a/README.md b/README.md index 427c650..c48ebdb 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,10 @@ It also served as a key to activate the switch that opens the Bifrost Bridge. ## Compatibility -| Version | SpringBoot Version | -|:---------:|:---------------------------------------:| -| **0.X.0** | from **2.2.0** (including 3.0.0 and up) | +| Version | SpringBoot Version | +|:----------------------:|:---------------------------:| +| **1.1.X** | from **3.3.0** | +| **1.0.X (deprecated)** | from **2.2.0** to **3.2.X** | ## Requirements diff --git a/hofund-core/src/main/java/dev/logchange/hofund/connection/HofundConnectionMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/connection/HofundConnectionMeter.java index 0a8c158..fb26cc2 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/connection/HofundConnectionMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/connection/HofundConnectionMeter.java @@ -13,7 +13,7 @@ public class HofundConnectionMeter implements MeterBinder { - private static final String NAME = "hofund_connection"; + private static final String NAME = "hofund.connection"; private static final String DESCRIPTION = "Current status of given connection"; private final HofundInfoProvider infoProvider; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/git/HofundGitInfoMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/git/HofundGitInfoMeter.java index 75d26fc..7fa1f8e 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/git/HofundGitInfoMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/git/HofundGitInfoMeter.java @@ -11,7 +11,7 @@ public class HofundGitInfoMeter implements MeterBinder { - private static final String NAME = "hofund_git_info"; + private static final String NAME = "hofund.git.info"; private static final String DESCRIPTION = "Basic information about application based on git"; private final HofundGitInfoProvider provider; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/graph/edge/HofundEdgeMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/graph/edge/HofundEdgeMeter.java index b95c676..8860b92 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/graph/edge/HofundEdgeMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/graph/edge/HofundEdgeMeter.java @@ -18,7 +18,7 @@ */ public class HofundEdgeMeter implements MeterBinder { - private static final String NAME = "hofund_edge"; + private static final String NAME = "hofund.edge"; private static final String DESCRIPTION = "Information about hofund edge, value is always 1.0, to check status use hofund_connection"; private final HofundInfoProvider infoProvider; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/graph/node/HofundNodeMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/graph/node/HofundNodeMeter.java index 8d61362..3188440 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/graph/node/HofundNodeMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/graph/node/HofundNodeMeter.java @@ -20,7 +20,7 @@ */ public class HofundNodeMeter implements MeterBinder { - private static final String NAME = "hofund_node"; + private static final String NAME = "hofund.node"; private static final String DESCRIPTION = "Information about hofund nodes, value is always 1.0, to check status use hofund_info"; private final HofundInfoProvider infoProvider; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/info/HofundInfoMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/info/HofundInfoMeter.java index 7616235..bfd9c9e 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/info/HofundInfoMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/info/HofundInfoMeter.java @@ -11,7 +11,7 @@ public class HofundInfoMeter implements MeterBinder { - private static final String NAME = "hofund_info"; + private static final String NAME = "hofund.info"; private static final String DESCRIPTION = "Basic information about application"; private final HofundInfoProvider provider; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/java/HofundJavaInfoMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/java/HofundJavaInfoMeter.java index 95d11bc..91c46e1 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/java/HofundJavaInfoMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/java/HofundJavaInfoMeter.java @@ -14,7 +14,7 @@ public class HofundJavaInfoMeter implements MeterBinder { - private static final String NAME = "hofund_java_info"; + private static final String NAME = "hofund.java.info"; private static final String DESCRIPTION = "Basic information about java that is running this application"; private final HofundJavaInfo info; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/os/HofundOsInfoMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/os/HofundOsInfoMeter.java index ec76ee4..ef6b8ff 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/os/HofundOsInfoMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/os/HofundOsInfoMeter.java @@ -1,6 +1,5 @@ package dev.logchange.hofund.os; -import dev.logchange.hofund.git.HofundGitInfoProvider; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; @@ -12,7 +11,7 @@ public class HofundOsInfoMeter implements MeterBinder { - private static final String NAME = "hofund_os_info"; + private static final String NAME = "hofund.os.info"; private static final String DESCRIPTION = "Basic information about operating system that is running this application"; private final HofundOsInfo info; diff --git a/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfoMeter.java b/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfoMeter.java index 36306af..d96f420 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfoMeter.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfoMeter.java @@ -11,7 +11,7 @@ public class HofundWebServerInfoMeter implements MeterBinder { - private static final String NAME = "hofund_web_server_info"; + private static final String NAME = "hofund.webserver.info"; private static final String DESCRIPTION = "Basic information about web server that is running this application"; private final HofundWebServerInfo info; diff --git a/hofund-spring-boot-autoconfigure/pom.xml b/hofund-spring-boot-autoconfigure/pom.xml index 72ed621..9250a2c 100644 --- a/hofund-spring-boot-autoconfigure/pom.xml +++ b/hofund-spring-boot-autoconfigure/pom.xml @@ -46,6 +46,13 @@ true + + org.springframework.boot + spring-boot-actuator-autoconfigure + ${spring-boot.version} + true + + io.micrometer micrometer-registry-prometheus diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/connection/springboot/autoconfigure/HofundConnectionAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/connection/springboot/autoconfigure/HofundConnectionAutoConfiguration.java index 80b0f4f..b032bdf 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/connection/springboot/autoconfigure/HofundConnectionAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/connection/springboot/autoconfigure/HofundConnectionAutoConfiguration.java @@ -7,8 +7,8 @@ import dev.logchange.hofund.connection.spring.http.HofundBasicHttpConnectionProvider; import dev.logchange.hofund.info.HofundInfoProvider; import dev.logchange.hofund.info.springboot.autoconfigure.HofundInfoAutoConfiguration; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -21,9 +21,7 @@ @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") @AutoConfigureAfter(HofundInfoAutoConfiguration.class) public class HofundConnectionAutoConfiguration { diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/git/springboot/autoconfigure/HofundGitInfoAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/git/springboot/autoconfigure/HofundGitInfoAutoConfiguration.java index be17623..19c0189 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/git/springboot/autoconfigure/HofundGitInfoAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/git/springboot/autoconfigure/HofundGitInfoAutoConfiguration.java @@ -2,9 +2,8 @@ import dev.logchange.hofund.git.HofundGitInfoMeter; import dev.logchange.hofund.git.HofundGitInfoProvider; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -12,9 +11,7 @@ @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") @EnableConfigurationProperties(HofundGitInfoProperties.class) public class HofundGitInfoAutoConfiguration { diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/graph/springboot/autoconfigure/HofundGraphAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/graph/springboot/autoconfigure/HofundGraphAutoConfiguration.java index 8472d56..b181cd7 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/graph/springboot/autoconfigure/HofundGraphAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/graph/springboot/autoconfigure/HofundGraphAutoConfiguration.java @@ -6,11 +6,10 @@ import dev.logchange.hofund.graph.node.HofundNodeMeter; import dev.logchange.hofund.info.HofundInfoProvider; import dev.logchange.hofund.info.springboot.autoconfigure.HofundInfoAutoConfiguration; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,9 +18,7 @@ @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") @AutoConfigureAfter({HofundInfoAutoConfiguration.class, HofundConnectionAutoConfiguration.class}) public class HofundGraphAutoConfiguration { diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/info/springboot/autoconfigure/HofundInfoAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/info/springboot/autoconfigure/HofundInfoAutoConfiguration.java index 5b6f815..98d9dc2 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/info/springboot/autoconfigure/HofundInfoAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/info/springboot/autoconfigure/HofundInfoAutoConfiguration.java @@ -2,9 +2,8 @@ import dev.logchange.hofund.info.HofundInfoMeter; import dev.logchange.hofund.info.HofundInfoProvider; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -12,9 +11,7 @@ @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") @EnableConfigurationProperties(HofundInfoProperties.class) public class HofundInfoAutoConfiguration { diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/java/springboot/autoconfigure/HofundJavaInfoAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/java/springboot/autoconfigure/HofundJavaInfoAutoConfiguration.java index 6bd9c72..6f59720 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/java/springboot/autoconfigure/HofundJavaInfoAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/java/springboot/autoconfigure/HofundJavaInfoAutoConfiguration.java @@ -1,19 +1,15 @@ package dev.logchange.hofund.java.springboot.autoconfigure; import dev.logchange.hofund.java.HofundJavaInfoMeter; -import dev.logchange.hofund.os.HofundOsInfoMeter; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") public class HofundJavaInfoAutoConfiguration { @Bean diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/os/springboot/autoconfigure/HofundOsInfoAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/os/springboot/autoconfigure/HofundOsInfoAutoConfiguration.java index f6a6afe..c561d38 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/os/springboot/autoconfigure/HofundOsInfoAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/os/springboot/autoconfigure/HofundOsInfoAutoConfiguration.java @@ -1,22 +1,15 @@ package dev.logchange.hofund.os.springboot.autoconfigure; -import dev.logchange.hofund.info.HofundInfoMeter; -import dev.logchange.hofund.info.HofundInfoProvider; -import dev.logchange.hofund.info.springboot.autoconfigure.HofundInfoProperties; import dev.logchange.hofund.os.HofundOsInfoMeter; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") public class HofundOsInfoAutoConfiguration { @Bean diff --git a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/web/springboot/autoconfigure/HofundWebServerInfoAutoConfiguration.java b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/web/springboot/autoconfigure/HofundWebServerInfoAutoConfiguration.java index 4806573..2d48107 100644 --- a/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/web/springboot/autoconfigure/HofundWebServerInfoAutoConfiguration.java +++ b/hofund-spring-boot-autoconfigure/src/main/java/dev/logchange/hofund/web/springboot/autoconfigure/HofundWebServerInfoAutoConfiguration.java @@ -3,9 +3,9 @@ import dev.logchange.hofund.web.HofundWebServerInfo; import dev.logchange.hofund.web.HofundWebServerInfoMeter; import dev.logchange.hofund.web.HofundWebServerInfoProvider; -import io.micrometer.prometheus.PrometheusMeterRegistry; import lombok.RequiredArgsConstructor; import org.apache.catalina.util.ServerInfo; +import org.springframework.boot.actuate.autoconfigure.metrics.export.ConditionalOnEnabledMetricsExport; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; @@ -13,9 +13,7 @@ @RequiredArgsConstructor @Configuration(proxyBeanMethods = false) -//available since spring boot 2.4.0 -//@ConditionalOnEnabledMetricsExport(value="prometheus") -@ConditionalOnClass(PrometheusMeterRegistry.class) +@ConditionalOnEnabledMetricsExport(value="prometheus") public class HofundWebServerInfoAutoConfiguration { @Bean diff --git a/hofund-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/hofund-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 74fc011..0000000 --- a/hofund-spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,9 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -dev.logchange.hofund.info.springboot.autoconfigure.HofundInfoAutoConfiguration,\ -dev.logchange.hofund.git.springboot.autoconfigure.HofundGitInfoAutoConfiguration,\ -dev.logchange.hofund.git.springboot.autoconfigure.HofundDefaultGitInfoProperties,\ -dev.logchange.hofund.connection.springboot.autoconfigure.HofundConnectionAutoConfiguration,\ -dev.logchange.hofund.graph.springboot.autoconfigure.HofundGraphAutoConfiguration,\ -dev.logchange.hofund.java.springboot.autoconfigure.HofundJavaInfoAutoConfiguration,\ -dev.logchange.hofund.os.springboot.autoconfigure.HofundOsInfoAutoConfiguration,\ -dev.logchange.hofund.web.springboot.autoconfigure.HofundWebServerInfoAutoConfiguration \ No newline at end of file diff --git a/hofund-spring-boot-e2e/pom.xml b/hofund-spring-boot-e2e/pom.xml index 3590edf..9baa886 100644 --- a/hofund-spring-boot-e2e/pom.xml +++ b/hofund-spring-boot-e2e/pom.xml @@ -14,7 +14,7 @@ 21 dev.logchange.hofund.HofundE2E - 3.2.2 + 3.3.0 7.0.0 diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundDefaultGitInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundDefaultGitInfoE2ETest.java index e2b4ad0..6a12020 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundDefaultGitInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundDefaultGitInfoE2ETest.java @@ -38,7 +38,7 @@ void shouldContainsHofundDefaultGitInfoWithValuesFromGitProperties() { String expected = "# HELP hofund_git_info Basic information about application based on git\n" + "# TYPE hofund_git_info gauge\n" + - "hofund_git_info{branch=\"alaMaKota\",build_host=\"someHostName\",build_time=\"11:12:33T17-02-2023\",commit_id=\"abcdef\",dirty=\"false\",} 1.0"; + "hofund_git_info{branch=\"alaMaKota\",build_host=\"someHostName\",build_time=\"11:12:33T17-02-2023\",commit_id=\"abcdef\",dirty=\"false\"} 1"; //when: String response = template.getForObject(path, String.class); diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundGitInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundGitInfoE2ETest.java index 58c796d..1b51c85 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundGitInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/git/HofundGitInfoE2ETest.java @@ -34,7 +34,7 @@ void shouldContainsHofundDefaultGitInfoWithValuesFromGitProperties() { String expected = "# HELP hofund_git_info Basic information about application based on git\n" + "# TYPE hofund_git_info gauge\n" + - "hofund_git_info{branch=\"feature-1-for-test-e2e\",build_host=\"someHostForTest\",build_time=\"14:12:13T11-11-2023\",commit_id=\"someAbbrevIdForE2eTest\",dirty=\"true\",} 1.0"; + "hofund_git_info{branch=\"feature-1-for-test-e2e\",build_host=\"someHostForTest\",build_time=\"14:12:13T11-11-2023\",commit_id=\"someAbbrevIdForE2eTest\",dirty=\"true\"} 1"; //when: String response = template.getForObject(path, String.class); diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/info/HofundInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/info/HofundInfoE2ETest.java index 3e85841..2299325 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/info/HofundInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/info/HofundInfoE2ETest.java @@ -31,7 +31,7 @@ void shouldContainsHofundInfoWithValuesFromProperties() { String expected = "# HELP hofund_info Basic information about application\n" + "# TYPE hofund_info gauge\n" + - "hofund_info{application_name=\"testapp\",application_version=\"1.2.3\",id=\"testapp\",} 1.0"; + "hofund_info{application_name=\"testapp\",application_version=\"1.2.3\",id=\"testapp\"} 1"; //when: String response = template.getForObject(path, String.class); diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/java/HofundJavaInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/java/HofundJavaInfoE2ETest.java index 650d01a..dfdd853 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/java/HofundJavaInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/java/HofundJavaInfoE2ETest.java @@ -41,7 +41,7 @@ void shouldContainsHofundJavaInfo() { String expected = "# HELP hofund_java_info Basic information about java that is running this application\n" + "# TYPE hofund_java_info gauge\n" + - "hofund_java_info{jvm_name=\"{jvmName}\",jvm_vendor=\"{jvmVendor}\",jvm_version=\"{jvmVersion}\",runtime_name=\"{runtimeName}\",runtime_version=\"{runtimeVersion}\",vendor_name=\"{vendor}\",vendor_version=\"{vendorVersion}\",version=\"{javaVersion}\",} 1.0" + "hofund_java_info{jvm_name=\"{jvmName}\",jvm_vendor=\"{jvmVendor}\",jvm_version=\"{jvmVersion}\",runtime_name=\"{runtimeName}\",runtime_version=\"{runtimeVersion}\",vendor_name=\"{vendor}\",vendor_version=\"{vendorVersion}\",version=\"{javaVersion}\"} 1" .replace("{jvmName}", jvmName) .replace("{jvmVendor}", jvmVendor) .replace("{jvmVersion}", jvmVersion) diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/os/HofundOsInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/os/HofundOsInfoE2ETest.java index 8f131ef..74453b2 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/os/HofundOsInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/os/HofundOsInfoE2ETest.java @@ -31,7 +31,7 @@ void shouldContainsHofundOsInfo() { String expected = "# HELP hofund_os_info Basic information about operating system that is running this application\n" + "# TYPE hofund_os_info gauge\n" + - "hofund_os_info{arch=\"{arch}\",name=\"{name}\",version=\"{version}\",} 1.0" + "hofund_os_info{arch=\"{arch}\",name=\"{name}\",version=\"{version}\"} 1" .replace("{arch}", arch) .replace("{name}", name) .replace("{version}", version); diff --git a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/web/HofundWebServerInfoE2ETest.java b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/web/HofundWebServerInfoE2ETest.java index 291dc53..347defb 100644 --- a/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/web/HofundWebServerInfoE2ETest.java +++ b/hofund-spring-boot-e2e/src/test/java/dev/logchange/hofund/web/HofundWebServerInfoE2ETest.java @@ -28,9 +28,9 @@ void shouldContainsHofundOsInfo() { String version = ServerInfo.getServerNumber(); String expected = - "# HELP hofund_web_server_info Basic information about web server that is running this application\n" + - "# TYPE hofund_web_server_info gauge\n" + - "hofund_web_server_info{name=\"Apache Tomcat\",version=\"{version}\",} 1.0" + "# HELP hofund_webserver_info Basic information about web server that is running this application\n" + + "# TYPE hofund_webserver_info gauge\n" + + "hofund_webserver_info{name=\"Apache Tomcat\",version=\"{version}\"} 1" .replace("{version}", version); //when: diff --git a/pom.xml b/pom.xml index a0c4c3c..5b49ff4 100644 --- a/pom.xml +++ b/pom.xml @@ -56,21 +56,21 @@ - 1.8 - 1.8 + 17 + 17 UTF-8 - 1.18.30 + 1.18.32 - [2.2.0.RELEASE,) - [1.3.0,) - [5.2.12.RELEASE,) - [9.0.27,) - [1.3.16,) - [1.7.28,) + [3.3.0,) + [1.13.0,) + [6.1.8,) + [10.1.24,) + [1.13.0,) + [2.0.13,) 2.22.2 From 122f3915ac892eab87906cdbb6d9a4a945da1679 Mon Sep 17 00:00:00 2001 From: pz2 Date: Sun, 30 Jun 2024 14:58:34 +0200 Subject: [PATCH 2/4] Spring Boot 3.3 and Java 17, but Core java 8 --- README.md | 8 ++--- hofund-core/pom.xml | 12 ++++--- .../AbstractHofundBasicHttpConnection.java | 10 +++--- .../hofund/web/HofundWebServerInfo.java | 2 +- hofund-spring-boot-autoconfigure/pom.xml | 15 +++------ hofund-spring-boot-e2e/pom.xml | 2 +- hofund-spring-boot-starter/pom.xml | 20 +++++++++++- hofund-spring/pom.xml | 4 +-- pom.xml | 32 ++++++++----------- 9 files changed, 56 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index c48ebdb..eb30ca6 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,10 @@ It also served as a key to activate the switch that opens the Bifrost Bridge. ## Compatibility -| Version | SpringBoot Version | -|:----------------------:|:---------------------------:| -| **1.1.X** | from **3.3.0** | -| **1.0.X (deprecated)** | from **2.2.0** to **3.2.X** | +| Version | SpringBoot Version | Java Version | +|:----------------------:|:---------------------------:|:------------------:| +| **2.X.X** | from **3.3.0** | 17 (hofund-core 8) | +| **1.0.X (deprecated)** | from **2.2.0** to **3.2.X** | 8 | ## Requirements diff --git a/hofund-core/pom.xml b/hofund-core/pom.xml index 34dda32..f20c293 100644 --- a/hofund-core/pom.xml +++ b/hofund-core/pom.xml @@ -5,28 +5,30 @@ dev.logchange.hofund hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT hofund-core jar - TODO + Core hofund classes allowing to publish prometheus metrics + + 1.8 + 1.8 + + io.micrometer micrometer-core - ${micrometer-io.version} - provided org.slf4j slf4j-api - ${slf4j.version} diff --git a/hofund-core/src/main/java/dev/logchange/hofund/connection/AbstractHofundBasicHttpConnection.java b/hofund-core/src/main/java/dev/logchange/hofund/connection/AbstractHofundBasicHttpConnection.java index 37bff84..2d8f5b6 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/connection/AbstractHofundBasicHttpConnection.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/connection/AbstractHofundBasicHttpConnection.java @@ -74,10 +74,10 @@ public HofundConnection toHofundConnection() { private StatusFunction testConnection() { return () -> { try { - log.debug("Testing http connection to: " + getTarget() + " url: " + getUrl()); + log.debug("Testing http connection to: {} url: {}", getTarget(), getUrl()); if (getCheckingStatus() == CheckingStatus.INACTIVE) { - log.debug("Skipping checking connection to: " + getTarget() + " due to inactive status checking"); + log.debug("Skipping checking connection to: {} due to inactive status checking", getTarget()); return Status.INACTIVE; } @@ -87,16 +87,16 @@ private StatusFunction testConnection() { urlConn.connect(); int responseCode = urlConn.getResponseCode(); - log.debug("Connection to url: " + getUrl() + " status code: " + responseCode); + log.debug("Connection to url: {} status code: {}", getUrl(), responseCode); if (responseCode >= 100 && responseCode < 400) { return Status.UP; } else { - log.warn("Error testing connection to: " + getUrl() + " finished with status code: " + responseCode); + log.warn("Error testing connection to: {} finished with status code: {}", getUrl(), responseCode); return Status.DOWN; } } catch (IOException e) { - log.warn("Error testing connection to: " + getUrl() + " msg: " + e.getMessage()); + log.warn("Error testing connection to: {} msg: {}", getUrl(), e.getMessage()); log.debug("Exception: ", e); return Status.DOWN; } diff --git a/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfo.java b/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfo.java index 5a525de..22b9038 100644 --- a/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfo.java +++ b/hofund-core/src/main/java/dev/logchange/hofund/web/HofundWebServerInfo.java @@ -17,7 +17,7 @@ public class HofundWebServerInfo { private final String version; public static HofundWebServerInfo create(String name, String version) { - log.info("Server name: " + name + " version: " + version); + log.info("Server name: {} version: {}", name, version); return HofundWebServerInfo.builder() .name(name) diff --git a/hofund-spring-boot-autoconfigure/pom.xml b/hofund-spring-boot-autoconfigure/pom.xml index 9250a2c..69b27b4 100644 --- a/hofund-spring-boot-autoconfigure/pom.xml +++ b/hofund-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ dev.logchange.hofund hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT hofund-spring-boot-autoconfigure @@ -19,44 +19,37 @@ org.springframework.boot spring-boot-autoconfigure - ${spring-boot.version} - provided + true dev.logchange.hofund hofund-spring ${project.version} - true + true - - org.apache.tomcat.embed tomcat-embed-core - ${tomcat-embed-core.version} - true + true org.springframework.boot spring-boot-configuration-processor - ${spring-boot.version} true org.springframework.boot spring-boot-actuator-autoconfigure - ${spring-boot.version} true io.micrometer micrometer-registry-prometheus - ${micrometer-registry-prometheus.version} true diff --git a/hofund-spring-boot-e2e/pom.xml b/hofund-spring-boot-e2e/pom.xml index 9baa886..40da781 100644 --- a/hofund-spring-boot-e2e/pom.xml +++ b/hofund-spring-boot-e2e/pom.xml @@ -3,7 +3,7 @@ hofund dev.logchange.hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT 4.0.0 diff --git a/hofund-spring-boot-starter/pom.xml b/hofund-spring-boot-starter/pom.xml index 06ca559..3c64410 100644 --- a/hofund-spring-boot-starter/pom.xml +++ b/hofund-spring-boot-starter/pom.xml @@ -3,23 +3,41 @@ hofund dev.logchange.hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT 4.0.0 hofund-spring-boot-starter + + org.springframework.boot + spring-boot-starter + + dev.logchange.hofund hofund-spring-boot-autoconfigure ${project.version} + dev.logchange.hofund hofund-spring ${project.version} + + + org.springframework.boot + spring-boot-starter-actuator + provided + + + + io.micrometer + micrometer-registry-prometheus + provided + \ No newline at end of file diff --git a/hofund-spring/pom.xml b/hofund-spring/pom.xml index 4c03d0c..41a6785 100644 --- a/hofund-spring/pom.xml +++ b/hofund-spring/pom.xml @@ -5,7 +5,7 @@ dev.logchange.hofund hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT hofund-spring @@ -25,8 +25,6 @@ org.springframework spring-core - ${spring-framework.version} - provided diff --git a/pom.xml b/pom.xml index 5b49ff4..bdfe6ad 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.logchange.hofund hofund - 1.1.0-SNAPSHOT + 2.0.0-SNAPSHOT pom hofund @@ -61,16 +61,7 @@ UTF-8 - 1.18.32 - - - - [3.3.0,) - [1.13.0,) - [6.1.8,) - [10.1.24,) - [1.13.0,) - [2.0.13,) + 3.3.1 2.22.2 @@ -79,11 +70,22 @@ 3.23.1 + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + org.projectlombok lombok - ${lombok.version} provided @@ -121,12 +123,6 @@ - - dev.logchange - logchange-maven-plugin - 0.6.1 - false - maven-release-plugin From e14e210a67faa768f18d2027c15dd74034867346 Mon Sep 17 00:00:00 2001 From: pz2 Date: Sun, 30 Jun 2024 15:08:04 +0200 Subject: [PATCH 3/4] Spring Boot 3.3 and Java 17, but Core java 8 --- changelog/unreleased/000001-sping-boot-3_3.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog/unreleased/000001-sping-boot-3_3.yml diff --git a/changelog/unreleased/000001-sping-boot-3_3.yml b/changelog/unreleased/000001-sping-boot-3_3.yml new file mode 100644 index 0000000..996e5b4 --- /dev/null +++ b/changelog/unreleased/000001-sping-boot-3_3.yml @@ -0,0 +1,8 @@ +title: Adjust project for Spring Boot 3.3 and Java 17. Hofund-Core still is based on Java 8. +authors: + - name: Peter Zmilczak + nick: marwin1991 + url: https://github.com/marwin1991 +type: changed #[added/changed/deprecated/removed/fixed/security/other] +merge_requests: + - 33 \ No newline at end of file From 8065136c38923b295a07a0f95648879c0cd45df8 Mon Sep 17 00:00:00 2001 From: Mateusz Piekarczyk Date: Sun, 30 Jun 2024 15:58:43 +0200 Subject: [PATCH 4/4] Made some cleanup of pom.xml dependencies, removed explicit versions in favor of using versions from spring-boot-dependency dependencyManagement --- hofund-spring-boot-e2e/pom.xml | 47 +++++------------------------- hofund-spring-boot-starter/pom.xml | 15 ++++------ pom.xml | 24 --------------- 3 files changed, 14 insertions(+), 72 deletions(-) diff --git a/hofund-spring-boot-e2e/pom.xml b/hofund-spring-boot-e2e/pom.xml index 713fa1b..1a1c39e 100644 --- a/hofund-spring-boot-e2e/pom.xml +++ b/hofund-spring-boot-e2e/pom.xml @@ -1,11 +1,12 @@ + 4.0.0 + hofund dev.logchange.hofund 2.0.0-SNAPSHOT - 4.0.0 hofund-spring-boot-e2e @@ -13,57 +14,28 @@ 21 21 dev.logchange.hofund.HofundE2E - - 3.3.1 - 7.0.0 - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot-for-e2e.version} - pom - import - - - - + + dev.logchange.hofund + hofund-spring-boot-starter + ${project.version} + + org.springframework.boot spring-boot-starter-web - - - - - - - - - - - org.springframework.boot spring-boot-starter-actuator - io.micrometer micrometer-registry-prometheus - - dev.logchange.hofund - hofund-spring-boot-starter - ${project.version} - - - org.springframework.boot @@ -77,8 +49,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-for-e2e.version} - @@ -90,7 +60,6 @@ io.github.git-commit-id git-commit-id-maven-plugin - ${git-commit-id-maven-plugin.version} get-the-git-infos diff --git a/hofund-spring-boot-starter/pom.xml b/hofund-spring-boot-starter/pom.xml index 8dfe67d..568e245 100644 --- a/hofund-spring-boot-starter/pom.xml +++ b/hofund-spring-boot-starter/pom.xml @@ -1,20 +1,16 @@ + 4.0.0 + hofund dev.logchange.hofund 2.0.0-SNAPSHOT - 4.0.0 hofund-spring-boot-starter - - org.springframework.boot - spring-boot-starter - - dev.logchange.hofund hofund-spring-boot-autoconfigure @@ -26,16 +22,17 @@ ${project.version} + + org.springframework.boot + spring-boot-starter + org.springframework.boot spring-boot-starter-actuator - provided - io.micrometer micrometer-registry-prometheus - provided diff --git a/pom.xml b/pom.xml index bdfe6ad..c824dbf 100644 --- a/pom.xml +++ b/pom.xml @@ -62,12 +62,6 @@ UTF-8 3.3.1 - - - 2.22.2 - 5.8.2 - 4.6.1 - 3.23.1 @@ -86,42 +80,27 @@ org.projectlombok lombok - provided org.junit.jupiter junit-jupiter - ${junit-jupiter.version} test - org.mockito mockito-junit-jupiter - ${mockito-junit-jupiter.version} test - org.assertj assertj-core - ${assertj.version} test - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.2.5 - - - maven-release-plugin @@ -133,7 +112,6 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 attach-sources @@ -154,7 +132,6 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 sign-artifacts @@ -176,7 +153,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.0 attach-javadocs