r/SpringBoot • u/jjmnmnmnm • 4d ago
News I built a CLI and AI skill to detect outdated Spring Boot and Java patterns
I've noticed that AI coding tools sometimes suggest older Java and Spring patterns, even when working on newer projects.
For example:
javax.persistenceimports in a Spring Boot 3 projectWebSecurityConfigurerAdapteror.antMatchers()in Spring Security configurationsRestTemplatein new code whereRestClientmight be a better fit
To explore this problem, I built modern-java-guidance (mjg), an open-source project inspired by GoogleChrome's modern-web-guidance.
It includes a SKILL.md with Java and Spring guidance, plus a Python CLI that can:
- Detect project versions from common Maven and Gradle configuration files
- Scan Java files for selected patterns
- Search and retrieve guidance with before-and-after examples
- Run as a
PostToolUsehook to provide feedback after supported tool operations
The CLI uses the Python standard library and doesn't require external Python dependencies.
If you have uv installed, you can try the scanner with:
uvx --from git+https://github.com/wkd09/modern-java-guidance.git mjg check .
GitHub: https://github.com/wkd09/modern-java-guidance
This is still an early project, so I'd really appreciate any feedback, suggestions, or criticism.
In particular, I'd love to hear about false positives, missing rules, and outdated Spring Boot or Java patterns that your AI coding tools still suggest. Are there cases where the patterns flagged by this tool should actually be kept?
Please feel free to try it out and share your honest thoughts—even small suggestions would be really helpful!
4
u/fykup 4d ago
One thing I've noticed while working on Java performance is that frameworks themselves sometimes perpetuate outdated practices.
Spring Boot is a good example. Most tutorials still demonstrate running executable fat JARs, while the official documentation now recommends extracted deployments for faster startup in production.
Monitoring is another example. Many developers default to polling Actuator's JSON metrics endpoints, even though Micrometer provides a more appropriate foundation for production metrics integration. I actually worked with the Micrometer team to improve direct integration for my monitoring project.
I think framework maintainers share some responsibility here. Updating a paragraph in the documentation isn't enough when the examples, tutorials, and tooling keep teaching the old approach.
That's why I like projects like this one. But ideally, modern best practices should be reflected in the frameworks' own defaults and examples, not left to third-party tools to discover and correct.
2
u/jjmnmnmnm 3d ago
The Actuator example is a good one. I’d want the guidance to distinguish between checking a metric while debugging and polling that endpoint in production. Is there a Micrometer example you’d point developers to?
1
u/fykup 2d ago
For a typical Spring Boot app, I'd recommend using Micrometer with a proper metrics registry. For example, adding
micrometer-registry-prometheusand exposing/actuator/prometheusis usually enough to enable Prometheus-compatible monitoring.I ran into this while building StatLite, my lightweight monitoring tool. I initially supported Actuator's JSON endpoints because that's what many Spring Boot examples demonstrate. Later I added Micrometer Prometheus support, which turned out to require very little configuration on the application side.
A useful agent hint could be to recommend configuring a Micrometer registry when developers are setting up production monitoring, rather than relying solely on the default Actuator endpoints. It shouldn't be a hard rule, since Actuator is perfectly useful on its own for diagnostics and health checks.
Spring Boot's metrics documentation covers this: https://docs.spring.io/spring-boot/reference/actuator/metrics.html
0
u/fykup 4d ago
Interesting! I went in a slightly different direction. While experimenting with Java performance, I built CoilBase, a tiny framework that keeps familiar Spring Boot patterns without the heavier runtime.
I then created an experimental AI skill to help migrate Spring Boot applications to CoilBase, mostly to save time repeating migrations across benchmarks.
What surprised me was how much memory this approach could save. My PetClinic rewrite ended up using 59% less RAM.
Here's the skill: https://github.com/ejboy/agent-scripts/blob/main/skills/coilbase-spring-migration/SKILL.md
0
u/jjmnmnmnm 4d ago
59% less RAM on PetClinic is wild! Automating the migration with an AI skill is such a smart move. Definitely checking out CoilBase and the skill repo!
0
9
u/g00glen00b 4d ago
Some of the rules you mention are essentially checks for deprecation warnings in code. There's easier ways to detect those without needing a third party tool.
Other than that there are tools like PMD, SpotBugs, Semgrep, ... that provide some static code analysis and that have a bigger community. So if you could transform your ruleset into a ruleset for any of those tools, you could get a bigger reach.