This project is based on https://github.com/sdeleuze/spring-kotlin-functional
The Main idea of this project is to provide a beautiful DSL to start a Spring Application on netty :
- Simple DSL
- No Annotation
- No JavaConfig
- No Classpath Scanning
Application dsl sample :
fun main(args: Array<String>) {
webfluxApplication(Server.NETTY) { // or TOMCAT
// group routers
routes {
router { routerApi(ref()) }
router(routerStatic())
}
router { routerHtml(ref(), ref()) }
// group beans
beans {
bean<UserHandler>()
bean<Baz>() // Primary constructor injection
}
bean<Bar>()
mustacheTemplate()
profile("foo") {
bean<Foo>()
}
}.run()
}
This project use :
- Spring WebFlux Reactive web server and client
- Spring Kotlin support
- Reactor Kotlin
- Functional bean definition with Kotlin DSL (no reflection, no CGLIB proxies involved)
- WebFlux functional routing declaration with Kotlin DSL
- WebFlux and Reactor Netty native embedded server capabilities
- Gradle Kotlin DSL
- Junit 5
@BeforeAll
and@AfterAll
on non-static methods in Kotlin
Current master
branch is based on standalone WebFlux runtime. Spring Boot is based
on JavaConfig and does not provide specific support functional bean definition yet (see
this issue where this is discussed).
That said, it is possible to use experimentally Spring Boot + functional bean definition together
via ApplicationContextInitializer
, see
this Spring Boot branch
for a concrete example.
Build the project and run tests with ./gradlew build
, create the executable JAR via ./gradlew shadowJar
, and run it via java -jar build/libs/spring-kotlin-functional-1.0.0-SNAPSHOT-all.jar
.