This library provides a Kotlin DSL for building Spring Webflux handlers. It starts where the routing DSL from Spring ends.
import de.bebauer.webflux.handler.dsl.*
@Configuration
class Config(private val repository: ItemRepository) {
private val getItem = handler {
pathVariable("id".stringVar) { id ->
complete(repository.findById(id)) or notFound()
}
}
@Bean
fun routes() = router {
GET("/item/{id}", getItem)
}
}
repositories {
maven {
url = uri("https://maven.pkg.github.com/bebauer/webflux-handler-dsl")
credentials {
username = "github username"
password = "github personal access token with read:packages scope"
}
}
}
Groovy:
implementation 'de.bebauer:webflux-handler-dsl:1.2.1'
Kotlin:
implementation("de.bebauer:webflux-handler-dsl:1.2.1")
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bebauer</id>
<name>bebauer-jfrog</name>
<url>https://bebauer.jfrog.io/artifactory/maven-releases</url>
</repository>
<dependency>
<groupId>de.bebauer</groupId>
<artifactId>webflux-handler-dsl</artifactId>
<version>1.2.1</version>
</dependency>
https://bebauer.gitbook.io/webflux-handler-dsl
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0