From a00a70624045e8d779802748a21b6e2185b5c677 Mon Sep 17 00:00:00 2001
From: "Claus U. (UsC)" <3043061+cl-a-us@users.noreply.github.com>
Date: Wed, 11 Dec 2024 11:50:27 +0000
Subject: [PATCH] Update to spring 3.4 and refactor according to current
suggestions
---
pom.xml | 2 +-
.../testapp/config/NativeReflectionRuntimeHintConfig.java | 2 +-
.../java/de/viadee/k8s/testapp/counter/CounterService.java | 7 +++----
src/main/resources/application.properties | 4 ++--
.../k8s/testapp/testapp/TestappApplicationTests.java | 6 +++---
5 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/pom.xml b/pom.xml
index 28f2025..317b989 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.3.5
+ 3.4.0
diff --git a/src/main/java/de/viadee/k8s/testapp/config/NativeReflectionRuntimeHintConfig.java b/src/main/java/de/viadee/k8s/testapp/config/NativeReflectionRuntimeHintConfig.java
index 41be192..f3382d1 100644
--- a/src/main/java/de/viadee/k8s/testapp/config/NativeReflectionRuntimeHintConfig.java
+++ b/src/main/java/de/viadee/k8s/testapp/config/NativeReflectionRuntimeHintConfig.java
@@ -26,7 +26,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
// especially for rendering k8s_env.html
hints.reflection().registerType(Map.Entry.class, MemberCategory.values());
// hints.reflection().registerType(HashMap.class, MemberCategory.values());
- // Innere Klassen
+ // inner classes
hints.reflection().registerTypeIfPresent(classLoader, "java.util.HashMap$Node"
, MemberCategory.values());
diff --git a/src/main/java/de/viadee/k8s/testapp/counter/CounterService.java b/src/main/java/de/viadee/k8s/testapp/counter/CounterService.java
index 8cb26f4..8721436 100644
--- a/src/main/java/de/viadee/k8s/testapp/counter/CounterService.java
+++ b/src/main/java/de/viadee/k8s/testapp/counter/CounterService.java
@@ -10,12 +10,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitialization;
import org.springframework.stereotype.Component;
-import java.sql.Timestamp;
-import java.util.Optional;
-
@Component
+@DependsOnDatabaseInitialization
public class CounterService {
private static final Logger log = LoggerFactory.getLogger(CounterService.class);
@@ -56,7 +55,7 @@ private void initCounter() {
Optional counter = counterRepository.findById(ID);
- if(!counter.isPresent()) {
+ if(counter.isEmpty()) {
CounterEntity newEntity = new CounterEntity();
newEntity.setId(ID);
newEntity.setCounter(0L);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index f06dbb8..915bc49 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -6,9 +6,9 @@ logging.level.de.viadee=debug
spring.jpa.hibernate.ddl-auto=update
-server.tomcat.max-threads=2
+server.tomcat.threads.max=2
-management.endpoints.enabled-by-default=true
+management.endpoints.access.default=read-only
management.endpoints.web.exposure.include=*
management.health.db.enabled=true
management.endpoint.health.show-details=always
diff --git a/src/test/java/de/viadee/k8s/testapp/testapp/TestappApplicationTests.java b/src/test/java/de/viadee/k8s/testapp/testapp/TestappApplicationTests.java
index a4d4d5f..337937c 100644
--- a/src/test/java/de/viadee/k8s/testapp/testapp/TestappApplicationTests.java
+++ b/src/test/java/de/viadee/k8s/testapp/testapp/TestappApplicationTests.java
@@ -4,10 +4,10 @@
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
-public class TestappApplicationTests {
+class TestappApplicationTests {
- @Test
- public void contextLoads() {
+ @Test
+ void contextLoads() {
}
}