Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/daggerok/kotlin-coroutines-spring-mvc

spring-webmvc (Tomact Servlet container) + kotlin-coroutines using Konrad Kaminski integration
https://github.com/daggerok/kotlin-coroutines-spring-mvc

coroutines kotlin-coroutines spring-mvc spring-mvc-application spring-mvc-framework

Last synced: 22 days ago
JSON representation

spring-webmvc (Tomact Servlet container) + kotlin-coroutines using Konrad Kaminski integration

Awesome Lists containing this project

README

        

# SpringMVC Coroutines [![Build Status](https://travis-ci.org/daggerok/kotlin-coroutines-spring-mvc.svg?branch=master)](https://travis-ci.org/daggerok/kotlin-coroutines-spring-mvc)
Using konrad-kaminski integration

```bash
./mvnw
java -jar target/*-SNAPSHOT.jar
http :8080
# see logs / Travis CI output
```

## details

_pom.xml_

```xml


1.3.0-M1



org.jetbrains.kotlinx
kotlinx-coroutines-core
${kotlinx-coroutines.version}


org.jetbrains.kotlinx
kotlinx-coroutines-reactor
${kotlinx-coroutines.version}


org.springframework.kotlin
spring-webmvc-kotlin-coroutine
0.3.7


org.springframework.kotlin
spring-kotlin-coroutine
0.3.7





spring-webmvc-kotlin-coroutine
spring-webmvc-kotlin-coroutine
https://dl.bintray.com/konrad-kaminski/maven

true
never
ignore


true
never
ignore


```

_App.kt_

```kotlin
@EnableCoroutine
@SpringBootApplication
class App

fun main(args: Array) {
runApplication(*args)
}
```

_MyCoroutinesResource.kt_

```kotlin
@RestController
class MyCoroutinesResource(private val myCoroputinesService: MyCoroutinesService) {

private val log = LogManager.getLogger()

@GetMapping("/**")
suspend fun defaultFallback(): Map {
log.info("before")
return myCoroputinesService
.suspendedMethod()
.also { log.info("after") }
}
}
```

* [konrad-kaminski / spring-kotlin-coroutine](https://www.kotlinresources.com/library/spring-kotlin-coroutine/#web-methods)
* [YouTube: Asynchronous Programming with Kotlin Coroutines in Spring](https://www.youtube.com/watch?v=aG4ArTL8KHY)