I've come across an article from four years ago that asked whether anyone is actually using Java modules in their projects. I'm curious to know if anyone has had experience using these modules alongside Spring or Spring Boot. I used to implement them in a desktop application, and I noticed significant improvements, particularly in reducing the application's size to less than a third of the original.
Now, I'm wondering if there are similar benefits for web applications. For those using modules with Spring, have you faced any issues with bean discovery? It seems like the dynamic nature of Spring could complicate things by making it hard to know which modules need to be opened. Also, has anyone experimented with jlink in Docker environments?
5 Answers
Honestly, I haven’t found a compelling reason to use modules yet. They’ve been around for years without much traction in the community. Most developers I know don’t use them, and it feels like they bring more complexity than value. I appreciate what modules can do, but right now, it seems like they serve mainly the JDK development and not so much for everyday projects.
I was quite excited about modules initially, thinking they'd allow true encapsulation as a library author, but it’s tough since not many downstream projects use modules. My experience has been mixed—while modules can introduce some pain points, they offer solid benefits for maintaining a cleaner architecture in the long run. That said, convincing others to adopt them remains a challenge. As for Spring, I’d just go with traditional setups unless you're really committed to making modules work.
There are many reasons devs shy away from creating their own modules. A lot of libraries still want to support older JDKs, so they skip modules altogether. Popular build tools like Maven also don’t provide great module support yet. The advantages of modules tend to appeal to a specific crowd focused on security and backward compatibility, which isn’t the majority. But fingers crossed, future developments might change this!
From what I've seen, using Java modules in Spring setups can be tricky. Spring's architecture relies heavily on reflection, which doesn't play nicely with the strong encapsulation that modules enforce. Many teams find the performance gains aren't worth the headache of managing configurations. If you're building CLI tools or simple desktop apps, modules can really streamline things and cut down the JRE size, but for Spring-based applications, the complexity often outweighs the benefits. So generally, it’s best to skip modules unless you enjoy wrestling with dependencies.
I love using modules, especially for organizing my code. I handle both simple utilities and games using the module system, but for web applications, I’ve found that managing dependencies becomes a bit sticky, particularly with Maven. There’s a learning curve involved, but once you adapt, using modules plays a big role in maintaining cleaner code and separating concerns. Just keep in mind that libraries need to start adopting this system for modules to really shine.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically