Andrew O'Hara
02/14/2025, 3:48 PMhttp4k-bridge-spring
module seem like a very exciting feature to show off. If I understand correctly, all the bridge does is let you expose a spring HttpHandler
as an autowireable Controller
. So you'd probably do a full migration in steps like this:
1. Migrate spring controllers to http4k, one-by-one
2. Replace the spring filters with http4k filters
3. Replace the server with an http4k one
4. Replace the autowiring with pure dependency injection
5. Replace the spring application with a main method
6. delete spring
But I'm not sure I'm practiced enough with Spring to come up with a dave
02/14/2025, 3:59 PMdave
02/14/2025, 4:00 PMAndrew O'Hara
02/14/2025, 4:02 PMdave
02/14/2025, 4:03 PMdave
02/14/2025, 4:03 PMAndrew O'Hara
02/14/2025, 4:05 PMdave
02/14/2025, 4:05 PMAndrew O'Hara
02/14/2025, 4:06 PMAndrew O'Hara
02/14/2025, 4:06 PMAndrew O'Hara
02/14/2025, 4:34 PMspring-data
and wherever RestTemplate
comes from. Since the RestControllers
depend on them, our HttpHandler
tests will still depend on spring, which eliminates the performance improvement of http4k. We would have to replace those dependencies before we can obtain any benefit
2. Spring locks their users into specific java versions. I believe my old colleagues are currently TRYING to upgrade to java 9. I fear that the bridge requiring java 21 will preclude the majority of spring users from upgrading to http4kTim Mortimer
02/14/2025, 4:58 PMdave
02/14/2025, 5:19 PMHow do you convince people to leave their precious spring behind? Besides testability.yeah, that's a real skill ๐ . A lot of time, projects have worked their way into such a state that they cannot deliver anything at all and are willing to listen to someone they think can help. Also - it's amazing how little people actually understand about how spring works under the covers when you ask them,...
dave
02/14/2025, 5:26 PMIt's very common for people to use spring extensions ...We can't expect all of the benefits to come at once when migrating. Performance is only one of them - the less stuff you have in your magical map the faster it will start/run, so it's about incremental improvement really. Of course, you can write the tests against your spring app to prove it's not busted as you go) as integration tests (or maybe we should bridge the inbound traffic as well so it hooks into the spring testing madness ๐ค), and then once you have finished you can just rip away the integration layer and you have a set of instant unit tests which should have a super fast test suite...
Andrew O'Hara
02/14/2025, 5:54 PMit's amazing how little people actually understand about how spring works under the coversIt's not just spring developers that are quilty of this, but I agree it's shockingly common, and I feel like it lowers the overall quality of developers
On point 2., the new step 1 becomes "upgrade to Java 21"I wish it were that easy. Spring dependency graphs are complicated, and upgrading spring versions requires major architectural revamps. You will often have to upgrade several major versions to get to one that supports java 21, and since it's so difficult to upgrade, developers often stick with the major version they started with 10+ years ago. Several migrations would be required just to begin gradually converting to http4k. Since it seems like only a small chunk of spring projects are prepared for a migration to http4k, I'm not sure I would have a particularly large audience to target in this potential video/series. I think I'm less excited to talk about this topic now, and would rather do one of my other ideas.
dave
02/14/2025, 5:57 PMAndrew O'Hara
02/14/2025, 6:00 PMTim Mortimer
02/14/2025, 6:56 PMAndrew O'Hara
02/14/2025, 7:03 PM