Closed mitrejcevski closed 5 years ago
org.springframework.kotlin:spring-kotlin-coroutine
doesn't support web methods by itself.
You need to add spring-webmvc-kotlin-coroutine
or spring-webflux-kotlin-coroutine
, depending on which spring web framework you're using, as a dependency. Then you'll be able to have suspending functions as web methods (such as your @GetMapping("sample") suspend fun sample()
here)
You're right. In fact this is actually stated in the documentation - see the Project modules section.
I'm trying to set up a basic spring-boot project and I have the following setup:
I use the following dependencies:
And here is what I have:
When I hit the endpoint I get the following exception:
When I comment out the
delay(1000)
line it returns the result nicely.I would like to ask - am I doing something wrong?
Thanks!