From 85b2e8711f30361078b81d27110a12f4fd67a27a Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Tue, 29 Jul 2025 12:30:35 +0200 Subject: [PATCH] update project --- build.gradle.kts | 6 +++--- gradle.properties | 2 +- .../kotlin/ltd/hlaeja/controller/NodeController.kt | 6 +++--- src/main/kotlin/ltd/hlaeja/service/NodeService.kt | 6 +++--- src/main/resources/application.yml | 14 ++++++++++++++ .../resources/{logback.xml => logback-spring.xml} | 0 src/main/resources/logback-test.xml | 11 ----------- src/test/kotlin/ltd/hlaeja/ApplicationTests.kt | 4 ++-- 8 files changed, 26 insertions(+), 23 deletions(-) rename src/main/resources/{logback.xml => logback-spring.xml} (100%) delete mode 100644 src/main/resources/logback-test.xml diff --git a/build.gradle.kts b/build.gradle.kts index bd80ba0..69a024c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ plugins { alias(hlaeja.plugins.kotlin.jvm) alias(hlaeja.plugins.kotlin.spring) - alias(hlaeja.plugins.ltd.hlaeja.plugin.service) + alias(hlaeja.plugins.spring.boot) alias(hlaeja.plugins.spring.dependency.management) - alias(hlaeja.plugins.springframework.boot) + alias(hlaeja.plugins.service) } dependencies { @@ -11,7 +11,7 @@ dependencies { implementation(hlaeja.kotlin.logging) implementation(hlaeja.kotlin.reflect) implementation(hlaeja.kotlinx.coroutines) - implementation(hlaeja.library.hlaeja.common.messages) + implementation(hlaeja.library.common.messages) implementation(hlaeja.springboot.starter.actuator) implementation(hlaeja.springboot.starter.cassandra) implementation(hlaeja.springboot.starter.cassandra.reactive) diff --git a/gradle.properties b/gradle.properties index 63fbafc..3ee286d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official version=0.2.0-SNAPSHOT -catalog=0.5.0 +catalog=0.11.0-SNAPSHOT container.port.host=9030 diff --git a/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt b/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt index ccaefb8..3075ad0 100644 --- a/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt +++ b/src/main/kotlin/ltd/hlaeja/controller/NodeController.kt @@ -1,11 +1,11 @@ package ltd.hlaeja.controller +import io.github.oshai.kotlinlogging.KotlinLogging import java.util.UUID import ltd.hlaeja.library.deviceConfiguration.Node import ltd.hlaeja.service.NodeService import ltd.hlaeja.util.toEntity import ltd.hlaeja.util.toResponse -import mu.KotlinLogging import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PutMapping @@ -25,7 +25,7 @@ class NodeController( @PathVariable node: UUID, ): Mono = service.getConfiguration(node) .map { it.toResponse() } - .also { log.debug("Endpoint getNodeConfiguration for node: {}", node) } + .also { log.debug { "Endpoint getNodeConfiguration for node: $node" } } @PutMapping("/node-{node}") fun updateNodeConfiguration( @@ -33,5 +33,5 @@ class NodeController( @RequestBody nodeRequest: Node.Request, ): Mono = service.updateDevice(nodeRequest.toEntity(node)) .map { it.toResponse() } - .also { log.debug("Endpoint updateNodeConfiguration for node: {}", node) } + .also { log.debug { "Endpoint updateNodeConfiguration for node: $node" } } } diff --git a/src/main/kotlin/ltd/hlaeja/service/NodeService.kt b/src/main/kotlin/ltd/hlaeja/service/NodeService.kt index f44fa79..dc47fd0 100644 --- a/src/main/kotlin/ltd/hlaeja/service/NodeService.kt +++ b/src/main/kotlin/ltd/hlaeja/service/NodeService.kt @@ -1,13 +1,13 @@ package ltd.hlaeja.service +import io.github.oshai.kotlinlogging.KotlinLogging import java.util.UUID import ltd.hlaeja.entity.NodeEntity import ltd.hlaeja.repository.NodeRepository -import mu.KotlinLogging -import org.springframework.stereotype.Service -import reactor.core.publisher.Mono import org.springframework.http.HttpStatus.NOT_FOUND +import org.springframework.stereotype.Service import org.springframework.web.server.ResponseStatusException +import reactor.core.publisher.Mono private val log = KotlinLogging.logger {} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index e5ece0c..9cc89b1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,6 +16,20 @@ spring: schema-action: none local-datacenter: datacenter1 +management: + endpoints: + access: + default: none + web: + exposure: + include: "health,info" + endpoint: + health: + show-details: always + access: read_only + info: + access: read_only + --- ############################### ### Development environment ### diff --git a/src/main/resources/logback.xml b/src/main/resources/logback-spring.xml similarity index 100% rename from src/main/resources/logback.xml rename to src/main/resources/logback-spring.xml diff --git a/src/main/resources/logback-test.xml b/src/main/resources/logback-test.xml deleted file mode 100644 index 3d69919..0000000 --- a/src/main/resources/logback-test.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - diff --git a/src/test/kotlin/ltd/hlaeja/ApplicationTests.kt b/src/test/kotlin/ltd/hlaeja/ApplicationTests.kt index 04ae6d6..1036e12 100644 --- a/src/test/kotlin/ltd/hlaeja/ApplicationTests.kt +++ b/src/test/kotlin/ltd/hlaeja/ApplicationTests.kt @@ -1,9 +1,9 @@ package ltd.hlaeja import org.junit.jupiter.api.Test -import org.springframework.boot.test.context.SpringBootTest +// import org.springframework.boot.test.context.SpringBootTest -@SpringBootTest +// @SpringBootTest class ApplicationTests { @Test