From 269cf69457e90b07fa268969de72eb24402da706 Mon Sep 17 00:00:00 2001 From: rowi1de Date: Sat, 23 Nov 2024 10:40:33 +0100 Subject: [PATCH] fix: https://github.com/spring-projects/spring-boot/issues/43273 --- README.md | 2 +- build.gradle.kts | 6 ++++++ compose.yaml | 2 ++ src/main/kotlin/netty/graalvm/HelloController.kt | 4 +--- src/main/kotlin/netty/graalvm/NettyNativeApiApplication.kt | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 716e236..e004c06 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,6 @@ See [Help.md](HELP.md) for framework hints ## Run and use ```shell ./gradlew bootBuildImage -docker-compose up -d +docker-compose --profile native up -d http http://localhost:8080/hello ``` diff --git a/build.gradle.kts b/build.gradle.kts index caf6026..b6e55df 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,6 +71,12 @@ kotlin { } } +graalvmNative { + metadataRepository { + version = "0.3.14" + } +} + tasks.withType { useJUnitPlatform() } diff --git a/compose.yaml b/compose.yaml index 54defad..fcd173b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,6 +12,8 @@ services: MYSQL_DATABASE: admin netty-native: image: docker.io/library/netty-native:0.0.1-SNAPSHOT + profiles: + - native ports: - 8080:8080 healthcheck: diff --git a/src/main/kotlin/netty/graalvm/HelloController.kt b/src/main/kotlin/netty/graalvm/HelloController.kt index 1199380..5820f7e 100644 --- a/src/main/kotlin/netty/graalvm/HelloController.kt +++ b/src/main/kotlin/netty/graalvm/HelloController.kt @@ -1,14 +1,12 @@ package netty.graalvm import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import reactor.core.publisher.Mono @RestController -@RequestMapping("hello") class HelloController { - @GetMapping("/") + @GetMapping("/hello") fun hello(): Mono = Mono.just("Hello, Netty!") } diff --git a/src/main/kotlin/netty/graalvm/NettyNativeApiApplication.kt b/src/main/kotlin/netty/graalvm/NettyNativeApiApplication.kt index 176a96a..9094816 100644 --- a/src/main/kotlin/netty/graalvm/NettyNativeApiApplication.kt +++ b/src/main/kotlin/netty/graalvm/NettyNativeApiApplication.kt @@ -3,9 +3,11 @@ package netty.graalvm import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.runApplication +import org.springframework.web.reactive.config.EnableWebFlux @SpringBootApplication @EnableConfigurationProperties +@EnableWebFlux class NettyNativeApiApplication fun main(args: Array) {