Spring application With KoFu configuration
Spring Fu is an incubator for Spring Boot programmatic configuration using DSLs in order to configure it explicitly with code in a declarative way, achieving great discoverability thanks to auto-complete.
Spring boot application With KoFu configuration:
val app = webApplication {
beans {
bean<SampleService>()
bean<SampleHandler>()
}
webMvc {
port = if (profiles.contains("test")) 8181 else 8080
router {
val handler = ref<SampleHandler>()
GET("/", handler::hello)
GET("/api", handler::json)
}
converters {
string()
jackson {
indentOutput = false
}
}
}
}
fun main() {
app.run()
}
Spring boot application With KoFu configuration:
val app = webApplication {
beans {
bean<SampleService>()
bean<SampleHandler>()
}
webMvc {
port = if (profiles.contains("test")) 8181 else 8080
router {
val handler = ref<SampleHandler>()
GET("/", handler::hello)
GET("/api", handler::json)
}
converters {
string()
jackson {
indentOutput = false
}
}
}
}
fun main() {
app.run()
}
Comments
Post a Comment