Earlier quoted context omitted.
That's a nice try, but the rest of the app would be[1]: import static spark.Spark.get; public class HelloWorld { public static void main(String[] args) { get("/hello", (req, res) -> "Hello World"); } } [1] http://sparkjava.com/
It is indeed a nice try, and the rest of the app would be: @SpringBootApplication @RestController class DemoApplication{ @GetMapping("/hello") fun hello() = "Hello, World!" } fun main(args: Array ) { runApplication (*args) } And this taught me that the best sinatra clone in java isn't really worth it in terms of lines of code saved (we save what? 3 lines of code? 6 with the imports?) when compared to a full-blown web…
fun main(args: Array) = run(*args) {
get { "Hello Kotlin" }
}
It's always easy to make a framework lightweight. But there is no argument that Spring requires a lot of tedious boilerplate in Java (some of which can be avoided with Kotlin), and annotations which are hard to understand.Lightweight frameworks don't really tell you "We do everything that Spring does in less lines", since at one point you'll ask them to make avocado toasts or something else that spring-bakery has a plugin for.
The real power of lightweight frameworks is their simplicity. This is not for everyone (that's why we've got Spring and Rails), but if everybody was fine with the tradeoffs that Spring makes, you'll see the same kind of frameworks ruling the Node.js and Go landscape.