From bc765f4ab462dc00feaae0315bdb4cb7ff714a46 Mon Sep 17 00:00:00 2001 From: Robert Wiesner Date: Sat, 23 Nov 2024 10:42:16 +0100 Subject: [PATCH] fix: https://github.com/spring-projects/spring-boot/issues/43273 (#1) --- 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) {