Blog

Integrate kweb and spring-boot

kweb provides the document to integrate spring-boot. https://docs.kweb.io/book/integrations.html#spring-boot

But in my opinion, it's bit complex and tricky way.

In my opinion, spring-boot users want to use the spring-boot's configuration loading feature and the bean management feature. But the sample code demonstrates the kweb integration with the spring-webmvc's servlet container.

Then, I wrote a sample code to use kweb on spring boot framework. https://github.com/tokuhirom/ktor-spring-boot-demo/blob/kweb-spring-boot-demo/src/main/kotlin/com/example/springbootdemo/SpringbootdemoApplication.kt

This code demonstrates, the code starts kweb server and it runs with spring-boot's beans and configurations. While the shutdown process, spring will call the "close" method on the Kweb instance!