Earlier quoted context omitted.
Could you be more explicit, perhaps with an example? Do you simply mean you prefer function/constructor parameters over DI?
Calling a constructor is DI. ‘new’ is the only DI framework required. Benefits: Unbelievably fast startup time No magic No annotations, XML or YAML required No classpath scanning related security vulnerabilities Conpletely deterministic In no other language is ‘calling a constructor’ considered so complicated a framework is required. Try it!
Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
121–130 of 139 posts
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#122Earlier quoted context omitted.
I'll guess and say Spark. Not the big data Spark. This one: sparkjava.com A nice piece of work in its own right.
You guessed correctly! Spark was fine, but was abandoned. Which means it was stuck using an end-of-life’d version of Jetty. Which meant that we could no longer pass security audits. Whereas Javalin continues to get frequently updated.
I suppose I'll try Javalin then next time I have the choice.
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#123Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#124Well done! Can't wait to see Loom become the default for web frameworks. Also spotted the Vue plugin - great to see this as so many light weight web apps with a few pages can benefit from using Vue but setting up all the build chain is such a drama that it's usually not worth it. Look forward to trying it out.
Thank you! The Vue support is the thing in Javalin I'm the most proud of. There are a hundred web frameworks for the JVM, but none of them have anything close to the Vue support Javalin has. Some people think it's trash, but for me it's perfect.
In general thanks for keeping Javalin simple and opinionated, it is my goto when I get to decide!
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#125Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#126this is very cool. quick question though - do u have a gradle build setup ? im new to java and saw this problem on spring boot. That you needed to have this bunch of complex directory structures cos of the way java packages worked. for e.g. the test directories were parallel to the src directory, so they could be named with the same package name. for a single file...i can just run java. but it would be nice to see a…
That's not a spring thing, but a java tools convention (having a src and test folder etc). Nothing stops you from doing it differently, but most tools work out of the box if you follow that setup. So better to just do it than having to fight with / configure every part of your pipeline.
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#127Earlier quoted context omitted.
Calling a constructor is DI. ‘new’ is the only DI framework required. Benefits: Unbelievably fast startup time No magic No annotations, XML or YAML required No classpath scanning related security vulnerabilities Conpletely deterministic In no other language is ‘calling a constructor’ considered so complicated a framework is required. Try it!
I have a few questions about this approach, cards on the table I mainly deal in C# where DI (through the framework) is the default. How do you manage the initialization of all of the dependencies? Do you need some sort of "root" where everything is initialized and passed in? That was all I could come up with while keeping it testable and that doesn't sound maintainable once you build up the number of dependencies.
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#128Looks interesting! One question about the response methods: If I would be using something like `ctx.result(inputStream)` - would it block the [lightweight] thread until all data is written. Or would the handler return and the data transfer happen in the background? One use-case I've only see marginally addressed in some frameworks is being able to run code past the point where all data is written - e.g. to record log…
There is no difference between OS threads and virtual threads in this scenario, and everything in Javalin is blocking (by default).
The `ctx.result()` method doesn't actually write anything directly, it sets a result that will be written later. If you add an "After" handler, this also happens before the request is written. When the request is finally written, it's written on the same thread, and it is a blocking operation.
There is a `RequestLogger` you can hook into that fires after the response has been written.
Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#129Re: Show HN: I finished v5 of a JVM framework I've spent spent half a decade making
#130Earlier quoted context omitted.
I'll guess and say Spark. Not the big data Spark. This one: sparkjava.com A nice piece of work in its own right.
You guessed correctly! Spark was fine, but was abandoned. Which means it was stuck using an end-of-life’d version of Jetty. Which meant that we could no longer pass security audits. Whereas Javalin continues to get frequently updated.
Aw, that's sad to hear. I've been out of JVM-in-anger space for awhile, but I always liked Spark when I was.