Having been in .NET, I am well versed in the support that micro web frameworks such as NancyFX and Web API have for IoC containers.
In similar frameworks in Ruby like Sinatra (NancyFX is based on Sinatra) it seems like you have the capability for dependency injection.
From what I see, because Java spark applications run as the main method, it doesn't seem like you can pass in your dependencies or IoC containers.
public class HelloWorld {
public static void main(String[] args) {
get("/hello", (req, res) -> "Hello World");
}
}
I have a hard time understanding how a framework like this could be useful without supporting this.
If this framework doesn't, is there another lightweight framework (Spring is not lightweight from what I remember, but maybe things have changed) that does support this?