I'm confused about SpringApplication.run, I think ...
# server
g
I'm confused about SpringApplication.run, I think I need to use a coorutine. ATM I have this SpringApplication.run statement in my main and 3 lines of other things I need to do every 5 minutes; how would I accomplish that?
r
You can use spring scheduled tasks for that
g
hmm... interesting, will read up on that. SpringApplication.run, runs the REST API... but then these other 3 lines file up the database that the REST API uses. What's better a spinger scheduled task or kotlin corutine?
r
You can probably schedule tasks with coroutines, but i'm not sure how it will work for long-running applications or whether it will work correctly with spring components.
g
thanks, looks like spring scheduled tasks are going to work out ok... thanks man, saved me time.
r
I would probably use dedicated solution - it will give you much more scheduling options.
s
You can use
runApplication
top level function instead, it is designed to provide a more idiomatic Kotlin syntax, see generated code on https://start.spring.io.