r/SpringBoot • u/rodolfo-mendes • May 23 '26
News Spring AI 1.0.8, 1.1.7, 2.0.0-M7 Available Now
r/SpringBoot • u/rodolfo-mendes • May 23 '26
r/SpringBoot • u/Successful_Blood4717 • May 23 '26
Hey everyone,
Like many of you, I chased the holy grail of 100% line/branch coverage in SonarQube and JaCoCo. I hit it, felt great, deployed to production... and immediately crashed due to an unhandled edge case between two external microservices. It made me realize that standard code coverage tools have a massive structural blind spot: they measure if a line of code was executed, not what your dependencies were doing when that line ran. I am building an open-source/lightweight tool called ScenarioLens to solve this, and I'd love to get your brutal, honest feedback on the concept.
Imagine a standard Spring Boot checkout service that calls two external dependencies inside a single try/catch block: an Inventory API and a Payment Gateway. You write two tests:
Instead of counting lines of code, ScenarioLens analyzes your code's Abstract Syntax Tree (AST) to map out every possible combination of external dependency states (Mocks) that could affect your logic. In the example above, it looks at your dependencies and says:
"Hey, you have 100% line coverage, but your Scenario Coverage is only 66%. You completely forgot to test what happens when Inventory succeeds but Payment fails."
This is where most testing tools fail. They blindly multiply every state and demand 10,000 tests. ScenarioLens uses pure static analysis to build a Control Flow Graph of your app. It looks at the structural rules of your code and prunes (deletes) impossible scenarios. For example, if an OUT_OF_STOCK state triggers an early return, it knows a downstream payment timeout is physically impossible to reach. It filters out the noise so you only see realistic gaps.
I am deeply evaluating the developer UX for this.
r/SpringBoot • u/Proof-Possibility-54 • May 22 '26
Couple of days ago I shared what I learned about Spring AI's chat memory. Today, here's what happened when I swapped the model behind it entirely.
Same Spring AI app. Same Java code. Same ChatClient, same @Tool annotations, same BeanOutputConverter for structured output. The only thing that changed: which model handled the requests.
OpenAI (GPT-4o) → Anthropic Claude Opus 4→ local Gemma 4 2B running through LM Studio.
The OpenAI → Claude switch was expected to work. Swap the starter dependency, update the config block, ship. Spring AI's provider abstraction is designed for this.
The local Gemma 4 2B switch was the interesting part. Same Anthropic starter dependency, just pointed at localhost:1234:
spring:
application:
name: spring-ai
ai:
anthropic:
api-key: ${LM_STUDIO_API_KEY}
base-url: http://127.0.0.1:1234
chat:
options:
model: google/gemma-4-e2b
memory:
repository:
jdbc:
initialize-schema: always
That's the entire config delta. LM Studio implements the Anthropic protocol, so Spring AI treats it as just another Anthropic-compatible endpoint. No separate "spring-ai-local" starter. No conditional Java code paths.
What I didn't expect — the 2B local model handled:
- Chat with memory (the same ChatMemoryAdvisor + JDBC repository setup from yesterday's post)
- Structured JSON output matching strict schemas
- Tool calling with proper parameter dispatch
- Code review (correctly identified a == vs .equals() bug in a real Java example)
Quality wasn't quite GPT-4o level, but it was meaningful enough that for what's probably 70% of business AI use cases — classification, summarization, structured extraction, simple agent loops — this would work in production. With zero per-request cost and full offline operation.
Recorded a walkthrough showing all three providers running the same demos (chat, memory, structured output, tool calling, code review) if you prefer video: https://youtu.be/lW0FMjDUzik
Repo with code: https://github.com/DmitryFinashkin/spring-ai
Has anyone here shipped multi-provider Spring AI in production yet? Curious how teams are handling provider routing — cost-based, latency-based, quality fallback, regional compliance — and what failure modes you're watching for.
r/SpringBoot • u/Character-Grocery873 • May 22 '26
Is spring cloud still relevant? Like spring cloud config, Eureka, cloud gateway? Or should i just learn K8s for services registery/discovery instead of Eureka, K8s's ConfigMap instead of Dedicated config server, i might stilll keep Spring Cloud Gateway, etc. And which one is mostly used in the industry?
r/SpringBoot • u/testix001 • May 21 '26
I got tired of manually diffing application-dev.yml against application-prod.yml before every deployment. So I built a small CLI to do it automatically — and then ran it against 50 well-known Spring Boot projects on GitHub to see how widespread the problem actually is.
The short version: 26 out of 50 projects had at least one issue.
1. The Actuator leak
# application-dev.yml
management.endpoints.web.exposure.include: "*"Completely reasonable in dev. Dangerous when it drifts into prod. /actuator/env returns all your environment variables — including secrets. /actuator/heapdump lets anyone download a full JVM heap dump.
The Spring PetClinic — Spring's own reference application — ships with include: * as a default. 78 modules across the scanned projects had this.
2. The database schema destroyer
# application-dev.yml
spring.jpa.hibernate.ddl-auto: updateConvenient in dev. If it drifts into prod and your entity model changes, Hibernate silently modifies your production schema. No migration script, no warning. I've seen this kill a database.
3. The missing feature flag
# dev + staging: feature.new-payment-flow.enabled: true
# prod: (key doesn't exist)Spring Boot falls back to null. If you're lucky you get a NullPointerException at startup. If you're not, it silently disables a feature in production that worked fine in every test environment.
Code review won't find it — you're looking at diffs, not at the relationship between files. Tests won't find it — they run against one profile. CI won't find it — the app starts fine.
I built spring-drift to catch this in CI or as a pre-deploy check:
$ spring-drift scan ./src/main/resources
✓ Found 4 profiles: default, dev, staging, prod
✗ 7 drift issues found
[DANGEROUS_DEFAULT] management.endpoints.web.exposure.include
default: health,info
dev: *
prod: * ← matches dev — likely accidental
[DANGEROUS_DEFAULT] spring.jpa.hibernate.ddl-auto
dev: update
prod: update ← destructive in production
[MISSING_KEY] feature.new-payment-flow.enabled
dev: true
prod: <missing> ← will fall back to null
Report written to drift-report.mdSingle binary via GraalVM Native Image (no JRE needed), ~26ms on a real project, outputs Markdown you can paste into a PR.
GitHub: https://github.com/jolle93/spring-boot-config-drift-detector
Docs + download: https://julianpaul.dev/spring-drift
r/SpringBoot • u/Hungry-Initial1623 • May 21 '26
So earlier i made a simple chat application in spring boot websockets and redis, got an idea to make my own doc collaboration tool but i realised there are lots of parameters like CRDT, I am confused and stuck how to transform the current codebase into that
r/SpringBoot • u/devmaterialized • May 19 '26
Throughout the internet I see a lot of libraries for everything, and my question to you is - what is your way of implementing JWT authentication?
r/SpringBoot • u/rack88 • May 19 '26
So the documentation seems to clearly say that the plan is to release spring-boot the "Thursday after the 3rd Monday of each month" per https://github.com/spring-projects/spring-boot/wiki/Supported-Versions#release-schedule, but it seems like this month the team is targeting:
I'm wondering what's special about May 2026? Some type of delay due to 4.1.0 dependencies?
r/SpringBoot • u/Zikou1997 • May 19 '26
I am experiencing an issue where my Spring Boot microservices fail to deregister from Eureka during a graceful shutdown. Because the deregistration HTTP request fails,
During shutdown, it seems the HTTP connection pool is closed before the DiscoveryClient attempts to send the final DELETE request to the Eureka server, resulting in an IllegalStateException: Connection pool shut down.
Could you help me understand how to configure my applications so that the deregistration completes successfully before the connection pools are destroyed?
Environment
Spring Boot: 3.2.1
Spring Cloud: 2023.0.0 (eureka-client 2.0.2)
Deployment: Docker Swarm (using stop-first update config)
Configuration
Eureka Server (application.yml):
```
yaml
spring:
application:
name: service-registry
cloud:
inetutils:
preferred-networks:
eureka:
server:
eviction-interval-timer-in-ms: 60000
response-cache-update-interval-ms: 10000
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
instance:
hostname: localhost
```
Eureka Client / Microservice (eureka-properties.yml via Config Server):
```
eureka:
client:
service-url:
defaultZone: ${EUREKA_SERVICE_ADDRESS:http://localhost:8761/eureka/}
register-with-eureka: true
fetch-registry: true
instance:
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}}
spring:
cloud:
inetutils:
preferred-networks:
```
Shutdown Logs
Here are the logs during the shutdown of one of the microservices (order-service). It shows the sequence of events leading up to the failure:
```
13:50:42.773 INFO --- [ionShutdownHook] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application ORDER-SERVICE with eureka with status DOWN
13:50:42.773 INFO --- [ionShutdownHook] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1779112242773, current=DOWN, previous=UP]
13:50:42.773 INFO --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:373b0e4bac...: registering service...
13:50:42.777 INFO --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:373b0e4bac... - registration status: 204
13:50:42.781 INFO --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
13:50:42.782 INFO --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
13:50:42.786 INFO --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
13:50:42.786 INFO --- [ionShutdownHook] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
13:50:45.787 INFO --- [ionShutdownHook] com.netflix.discovery.DiscoveryClient : Unregistering ...
13:50:45.791 INFO --- [ionShutdownHook] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://registry-dev:8761/eureka/} exception=Connection pool shut down stacktrace=java.lang.IllegalStateException: Connection pool shut down
13:50:45.792 WARN --- [ionShutdownHook] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: Connection pool shut down
13:50:45.793 ERROR --- [ionShutdownHook] com.netflix.discovery.DiscoveryClient : DiscoveryClient_ORDER-SERVICE/order-service:373b0e4bac... - de-registration failedCannot execute request on any known server
13:50:45.797 INFO --- [ionShutdownHook] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
```
Is there a specific configuration I am missing to ensure the deregistration happens before the connection pools are closed? Any guidance on how to resolve this would be greatly appreciated.
r/SpringBoot • u/Potential_Spot_5847 • May 18 '26
Hello, I am new to the world of spring and java backend in general. I am starting with "Spring Start Here" by Laurentiu Spilca.
I am having a strange issue with my pom.xml in IntelliJ. While my spring-context dependency seems to be accepted, the spring-jdbc dependency remains red no matter what I do.
The Problem:
When I use version 7.0.7 (which IntelliJ suggested), spring-context turns white, but spring-jdbc stays red with the error "Artifact not found."
What I have tried:
My Environment:
how to rectify this error? why is this error happening?
r/SpringBoot • u/Substantial-Bee-8298 • May 18 '26
..
r/SpringBoot • u/j7n5 • May 18 '26
Hello,
Anyone here already deploy GraalVM compiled spring boot app in production?
What is you take?
Are you happy with it or is it still not recommended for prod?
The native image have to be tested for sure. how does it feel to have longer build time for native test. Is it the price to pay for efficient memory ?
r/SpringBoot • u/FooBarBuzzBoom • May 17 '26
Hey! I’ve started learning about Hexagonal Architecture and DDD, and I decided to make the jump from theory to practice.
So far, I’ve developed a microservice that I split into three layers: domain, application, and infrastructure. On the domain side, I created the aggregate along with its entities and Value Objects. From what I understand, ports should be the interfaces that handle communication with the domain, and they come in two types: input (driver) and output (driven). Use cases are supposed to act as orchestrators that implement the input ports and use the output ports to make operations possible end-to-end, without messing with the domain logic (I've read about the anemic domain model).
One thing that seems quite strange to me is on the input ports side, where many devs create a separate interface for every single operation. I understand the Interface Segregation Principle, but this kind of implementation feels a bit extreme. I would prefer to group all related operations into a single interface, much like you would do in a controller.
Another point of confusion is related to DTOs (Data Transfer Objects). First of all, a lot of the validation becomes redundant since it's already handled at the domain entity/VO level. Secondly, it feels bizarre not to use Value Objects inside my DTOs. Even though the AI suggested this could cause serialization issues, I don't see the point of just throwing properties in there and repeating everything manually.
The adapters part makes sense to me, though I don’t agree with the definition "implements the ports", except on the output side. On the input side, I see them more as the Adapter pattern, which basically makes two incompatible things compatible, acting as translators for REST, DBs, etc.
Also, should infrastructure entities simply reference VOs and other infrastructure entities, right? A lot of things, like addresses, are going to introduce redundancy at the entity level now. How is this usually handled?
Also, at the application layer, should ports practically be grouped by domain or mixed together? Same question for DTOs.
Given the discrepancies with what I read in articles/books/tutorials, maybe some of you have more practical experience and can tell me how you’ve seen these scenarios implemented correctly and scalably in production.
Thanks!
r/SpringBoot • u/Oofcito • May 18 '26
hello!! so i'm about to enter my first year of university in the US, and my university has a thing called "co-op" where you basically work as an intern of sorts for a company over a 6 month period (either one time or three times), and if they like you enough, they can hire you post-gdad. companies can range from small start-ups to big companies
i'd like to have like 1 or 2 spring boot backend projects before i start applying for co-ops (which will be in ~a year from now), but i'd like to have something that would make me stand out instead of some basic CRUD project. my dilemma is whether i would *have* to do something involving microservices, no matter what the project idea is (as it may look impressive or whatever), or if i have the freedom to choose depending on what my requirements are and it being built as a microservice or not is irrelevant. project ideas aren't exactly my worry tbh because i do have a few in mind and i could probably get some AI to help me with that if I get suuuper stuck; it's
more so that architectural decision yk... what do you think would be the smartest decision for me?
r/SpringBoot • u/Delicious-Air-829 • May 17 '26
I am confused in both the courses Telesko industry ready course but it only gives microservices in recorded videos on the other hand anuj bhaiya Springboot cohort 5 gives hands on microservices project in cohort 5 which one to choose? Any suggestions?
r/SpringBoot • u/CounterBrilliant9361 • May 15 '26
Hey Folks!! 👋
While managing and monitoring financial transactions I found them pretty scattered to be kept track on. Different applications screwed through out.
Recently, I thought of solving it. So, I invite you to go through my Personal Finance Investment Platform (PFIP) but as a developer (🤫 as it's not production ready yet). Be a critique as and when needed.
This isn't just a "CRUD app" with microservices, there's real thought behind the JWT flow, the Redis caching layer, the per-service DB isolation, and the Angular interceptor/guard pattern that keeps the frontend clean and secure.
Drop your feedback below — what would you refactor? What's missing? All constructive thoughts welcome.
r/SpringBoot • u/Entire-Position9690 • May 15 '26
If you need to retire an old API version, but you have no idea which clients are still hitting it, no standard way to warn them, and no clean mechanism to eventually shut it off.
We built spring-api-sunset to solve this. It's a lightweight Spring Boot 3.x starter that manages the full API deprecation lifecycle through a single annotation.
Add @Sunset to a controller or method:
From that point on, the library automatically:
Sunset and RFC 9745 Deprecation headers to every response, so clients can programmatically detect the deprecationLink header pointing to the replacement endpointapi.sunset.requests counter with endpoint/consumer tags, plus gauges for deprecated and sunset endpoint counts)/actuator/api-lifecycle that lists all deprecated endpoints with their dates, replacement URLs, days remaining, and current phaseMost teams handle API deprecation ad-hoc: a comment in Slack, maybe a custom header someone remembers to add, and a TODO that never gets done. Meanwhile clients keep hitting the old endpoint because there's no machine-readable signal telling them it's going away.
The HTTP standards for this exist (RFC 8594 for Sunset header, RFC 9745 for Deprecation header) but nobody implements them because it's tedious boilerplate. This library makes it a one-liner.
The consumer tracking feature is particularly useful — set spring.api-sunset.consumer-header=X-Api-Key and your metrics will show exactly which API consumers are still on the deprecated version, so you can reach out to them directly instead of broadcasting to everyone.
spring:
api-sunset:
enabled: true
on-sunset: return-410 # or "continue" to keep serving with headers
consumer-header: X-Api-Key
Before sunset — normal response with warning headers:
Sunset: Wed, 01 Oct 2025 00:00:00 GMT
Deprecation: @1743465600
Link: </api/v2/users>; rel="successor-version"
After sunset — 410 Gone with Problem Detail:
@Sunset overrides class-levelAvailable on Maven Central:
implementation("io.github.atlancia-labs:spring-api-sunset:0.1.1")
GitHub: https://github.com/Atlancia-Labs/spring-api-sunset
Would love feedback, especially if you've dealt with API deprecation at scale and see gaps in this approach. What would you add?
r/SpringBoot • u/chief_jaydeep • May 15 '26
Sharing my Spring Boot + Angular resource document for anyone learning or building full-stack applications.
Includes tutorials, architecture references, authentication,
deployment basics, and more.
r/SpringBoot • u/Pijushm • May 16 '26
r/SpringBoot • u/JobRunrHQ • May 15 '26
Quick heads-up for the Spring Boot crowd: JobRunr 8.6.0 just shipped and the Spring Boot starter (both 3.x and 4.x) now boots the Background Job Server and Dashboard on ApplicationReadyEvent instead of SmartInitializingSingleton.afterSingletonsInstantiated(). That means JobRunr only starts polling once your application context is fully initialized, which avoids a whole class of subtle startup races where a job ran before its dependencies were ready.
Also in this release:
--illegal-final-field-mutation=deny)withDetails → withJobLambda rename for the Fluent API (old name deprecated, still works)Release blogpost with code-examples: https://www.jobrunr.io/en/blog/jobrunr-v8.6.0/
r/SpringBoot • u/Character-Grocery873 • May 15 '26
How do you set up your spring boot security with reactjs as being the frontend? I use the session based auth (no jwt) for simplicity but the problem is with csrf.
I have ```csrf(csrf -> csrf.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse``` in my csrf web security config too but when i log in and send the form, i can't log in because obviously csrf token isn't there YET. So how can users even get a csrf token first before logging in? I tried using the ignoreMatchers("...") on csrf config aswell, it logged me in but it only sent me the JSESSION and no XSRF token in the header.
r/SpringBoot • u/hiura-mihateUwU • May 14 '26
Hi, I’m coming from Go and trying to get comfortable with Java’s approach to error handling, but I’m struggling with the idea of unchecked exceptions.
In Go, I’m very used to explicit error handling:
```go
if err != nil {
return err
}
```
So when reading code, I immediately know which operations may fail.
But in Java, many exceptions are RuntimeException subclasses and are not required to be declared or handled. This feels very different to me because:
- I can’t always tell what methods may throw
- the compiler/IDE doesn’t force handling
- failures can appear unexpectedly at runtime
- I feel like I have to “trust” APIs more
I especially noticed this while learning Spring Boot, where many framework/library exceptions are unchecked, but I’m also asking thi
So I want to ask experienced Java developers:
I’m not trying to argue that one language is better than another. I genuinely want to understand how experienced Java developers think about error handling and avoid “surprise runtime explosions” in large applications.
r/SpringBoot • u/palebt • May 14 '26
r/SpringBoot • u/rodolfo-mendes • May 14 '26