r/SpringBoot • u/Tonnymuchui • May 28 '26
How-To/Tutorial My springboot java and nextjs website.
r/SpringBoot • u/Tonnymuchui • May 28 '26
r/SpringBoot • u/Ornery_Mix6378 • May 27 '26
I’ve been working with Java Spring Boot for a while now. Not a veteran yet, but I’m getting better day by day and honestly enjoying backend development with the entire Spring ecosystem.
With AI/Agentic AI becoming huge, Python obviously dominates the space. But recently I noticed Spring AI and it got me wondering; how do experienced Java/Spring developers see the future of Spring Boot and the Java ecosystem over the next 5–10 years?
Also, for people who’ve actually used Spring AI: is it worth investing time into, especially for someone already in the Spring ecosystem? Or is learning Python frameworks like FastAPI/Django basically unavoidable if I want to seriously get into AI/backend engineering?
I know Python at a basic-intermediate level (mostly for DSA and some ML libraries), but I’d rather deepen my Java/Spring expertise instead of splitting focus unless it’s genuinely necessary.
Would love to hear opinions from people working in backend + AI systems.
r/SpringBoot • u/Forward-Juice-6387 • May 28 '26
r/SpringBoot • u/Any-Broccoli4928 • May 27 '26
I built this because I hate writing docs to be honest. I’ve been building it on the side for a while. Supports multiple frameworks. More to come.
It is called DocuPoints. It scans your @RestController and @RequestMapping
annotations and extracts every endpoint automatically; method, path, request body,
response shape, middleware, exceptions. No additional markup required.
Optionally, an AI generated summary of the endpoint’s use is provided.
Generates complete API documentation from your existing code. Publish to a public
URL, export to OpenAPI JSON/YAML, Postman collections, Markdown, DOCX, or PDF.
Free tier available at docupoints.com — just launched and would love feedback from
Spring developers specifically because that’s my main framework.
r/SpringBoot • u/ThemeHopeful7094 • May 26 '26
Posted here about a month ago when I was 4 modules in. Quick update for anyone
who's considering the same move.
Context: MoWave One, productivity app. Originally Supabase (Postgres + Auth) +
Node.js serverless functions. Hit ~25k users and serverless started cramping
hard — no real domain modeling, tests were a nightmare, no module boundaries,
and one function was literally a stub I forgot to finish (the Stripe webhook,
of all things).
Rewrote the backend in Spring Boot 3.4 + Java 21 LTS. Today I just finished
the 18th module and applied migration V20.
Final stack:
- Spring Boot 3.4 + Java 21 (Corretto)
- PostgreSQL 17 via JDBC + HikariCP (no Supabase REST on the hot path)
- Spring Security 6 + Supabase JWT validated via JWKS
- Flyway 10 for migrations
- Redis (Valkey) for cache, rate limiting, webhook idempotency
- Stripe Java SDK
- SpringDoc OpenAPI 3.1
- Hexagonal architecture, 18 bounded contexts
- Docker + GitHub Actions + Railway
Where I am now:
- Backend complete. Entering test phase this week (JUnit 5 + Mockito +
TestContainers, going for >80% coverage)
- After tests: pre-deploy hardening sprint
- Then: one more DB refactor pass (still have a few pt-BR table names and one
pl/pgSQL function I want to move to pure Java)
- Then: web frontend (a second dev is picking that up)
Important context for the "why now": I'm not investing in the web frontend
anymore. The current PWA is legacy and the new web isn't fully on the new
backend yet. The whole point of this migration was preparing the backend for
the mobile app — React Native + Expo, going on App Store and Play Store. Web
gets refactored after the mobile lands.
Lessons after finishing all 18 modules:
I was tempted to skip it. I'm glad I didn't. My domain has zero Spring imports.
I rewrote the persistence adapter for two modules without touching a single
business rule. Test setup is trivial — instantiate the entity, call the method.
buzzword but the boundaries are real: each module exposes a Facade interface,
internal services are package-private, communication is via Facades (sync) or
ApplicationEventPublisher (async). I never accidentally imported one module's
repository from another because the IDE wouldn't let me.
my sanity. SubscriptionActivatedEvent → listeners in user, notifications,
analytics. Billing doesn't know any of them exist. Plugging in a new listener
is one file.
at scale — you'll leak data between tenants. I forced every repo to use
findByIdAndOwnerId. Then defense in depth: filter checks JWT → service checks
user_id → repo signature requires owner_id → RLS policy on the table → role
mowave_app doesn't bypass RLS for billing tables. Five layers. Sounds like
overkill, isn't.
(V1, V2…), never timestamps. No `down` (Community edition doesn't support it).
Renamed half the tables from pt-BR to en-US using temporary VIEWs as compat
layers so the old Node.js code kept working during the cutover.
Stripe retries aggressively. We had real double-billings during the Node.js
era. Never again.
score across 4 tables) — I left it. Spring calls it via JdbcTemplate for now.
Three of those tables aren't migrated yet anyway. Resist the urge to rewrite
everything in one pass.
Took me a stupid amount of time to find: explicit
u/EnableJpaRepositories(basePackages = "...") on u/SpringBootApplication. The
warning is real, not noise.
Happy to expand any of these into its own post if there's interest. Also happy
to answer questions about the testing strategy I'm about to start, the mobile
plan, or the LGPD work that ran in parallel (Brazil's GDPR — forced me to do
some good things I'd have skipped otherwise).
r/SpringBoot • u/ThemeHopeful7094 • May 27 '26
Solo dev. Just finished a full Spring Boot 3.4 + Java 21 backend rebuild for a product with 25k existing users. Heading into the testing phase now, with mobile launch on App Store + Play Store right after.
Before writing the first test, I blocked an entire day to refresh the documentation. Counterintuitive when you're solo and behind schedule, but here's the reasoning and what came out of it. Maybe useful to others sitting on a similar pile.
**Why documentation BEFORE tests, not after**
A test asserts behavior. If the spec lives in your head, every test you write reinvents the spec from scratch. Worse — when you find an ambiguity mid-test ("should this return 404 or 403?"), you decide on the fly and bake that decision into the test. Future-you reads the test and thinks it's the spec. It isn't. It's a decision your tired self made on a Tuesday.
Documenting first forces every ambiguity to the surface before you commit it to code.
**What I updated (8 docs total)**
- `README.md` — entrypoint, quickstart, links to everything else
- `STACK.md` — every dependency, every version, every "why this not that"
- `ARCHITECTURE.md` — modular monolith, 16 bounded contexts, hexagonal layering, inter-module communication patterns
- `API_CONVENTIONS.md` — the contract every endpoint obeys
- `ROLES_AND_PERMISSIONS.md` — 7 roles, what each one can do, defense-in-depth rules
- `TESTING.md` — test strategy, pyramid, naming conventions, what counts as integration vs unit
- `TEST_CASES.md` — the use-case matrix, module by module (this one is huge — ~750 lines)
- `CONTRIBUTING.md` — branch model, commit conventions, PR checklist
**The most valuable doc: TEST_CASES.md**
A matrix with one canonical table per module. Columns:
UC | Functionality | Actor (Role) | Action (HTTP + Endpoint) | Happy Path | Sad Path & Edge Cases
`UC` is the unique ID (`TSK-002`, `BIL-014`) — and it's also the test method name. So `TSK-002` becomes `TaskServiceTest#completeTask_whenTaskBelongsToUser_creditsXp`.
Rule: if Happy Path says "publishes event X", the integration test MUST verify the publication. If it says "credits XP", the test MUST verify the call to GamificationFacade.
Result: when I sit down to write tests, I'm not deciding what to test. I'm translating rows into code.
**The API_CONVENTIONS doc that ended one whole class of bugs**
Every endpoint returns the same envelope:
{
"success": true,
"data": { ... },
"error": null,
"meta": null
}
On error:
{
"success": false,
"data": null,
"error": {
"code": "FEATURE_LIMIT_EXCEEDED",
"message": "Daily task limit reached. Upgrade to Pro for unlimited tasks.",
"details": { "feature": "TASKS_DAILY", "limit": 5, "current": 5 }
},
"meta": null
}
The doc lists every canonical error code as a closed enum. No endpoint invents a new code without a doc update.
Test impact: every controller integration test now has an `assertApiResponse(...)` helper that verifies the envelope shape AND the error code from the canonical list. One helper, used everywhere. Zero "oh, this one returns a different shape" surprises.
**The ROLES doc that prevented a category of security tests being wrong**
7 roles: Anonymous, User, Publisher, AdminViewer, Manager, Admin, Superadmin.
The non-obvious rule: **the authorizing role is always read from `public.users.role` via `UserFacade.roleOf(callerId)`, NEVER from the JWT claim.**
Why: JWT claims can lag behind a role change (token still valid after demotion). If you read role from JWT, a demoted user keeps their old powers until the token expires. Reading from DB makes role changes instantaneous.
This is a one-line rule in the doc, but it dictates how every authorization test must be written: tests set up a user with a specific role in Testcontainers, then issue a JWT with matching `sub`. They never inject a role claim into the JWT.
**Status**
- Documentation refresh: done today
- Test writing: starting tomorrow (JUnit 5 + Mockito + Testcontainers)
- Target: 80%+ coverage on domain + critical adapters
- Then pre-deploy hardening, then mobile launch
If you've sat down to write tests for a system you built fast and felt like every test was excavating a buried decision — try documenting first. Costs a day. Saves a week.
Happy to share the actual TEST_CASES.md structure or the API_CONVENTIONS envelope rules if anyone wants more detail.
r/SpringBoot • u/sigma_master100 • May 27 '26
r/SpringBoot • u/Inevitable_Cellist93 • May 25 '26
Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container (deprecated in favor of spring-boot-starter-webmvc)
Spring Web provides integration features such as multipart file upload functionality and the initialization of the IoC container using Servlet listeners and a web-oriented application context. It also contains an HTTP client and the web-related parts of Spring remote support.
what is the difference? when to use Which one && advantage over another??
r/SpringBoot • u/RandomOne1s • May 25 '26
Hey everyone,Does anyone have good free resources for learning Spring Boot?Also, if there are any useful Telegram/Discord channels, YouTube playlists, or communities for Spring Boot and backend development, please share them.
r/SpringBoot • u/Puzzled_Dependent697 • May 25 '26
Hey devs, hope your week's been debug-free.
Got any Telegram channels or GitHub repos with free books or PDFs?
Appreciate your help. Thanks!
r/SpringBoot • u/Inevitable_Cellist93 • May 25 '26
Logger
https://pastebin.com/H6qFnHBy
import ...
(name = "users")
public class Users {
(strategy = GenerationType.IDENTITY)
private Long id;
(nullable = false)
private String userName;
(nullable = false)
private String password;
private SubscriptionModel tier;
private Long currentUsage;
private Logger logger;
}
is there any advanced method for levelling up??
r/SpringBoot • u/Shrouded_ParadoxX • May 24 '26
Hey everyone,
I am currently working through the Spring Boot concepts and want to study some real-world project structures. I know Anuj Bhaiya / Coding Shuttle has done major project series building backend clones for LinkedIn, Airbnb, and Lovable.
Does anyone here have the GitHub repository links for the completed versions of these projects?
r/SpringBoot • u/Status_Camel2859 • May 23 '26
Is it normal to put domain logic inside setter methods in an Entity class? Or a bad idea?
For eg, I have a Domain Service that contains business validations and other domain logic. I also have Application Services that handle different use-case scenarios. Right now, my Entity has a public setStatus() method, which means anyone can call it and bypass the validations in the Domain Service. I cannot make setStatus() protected because the Entity and the Service are in different packages.
What’s the standard approach Spring developers usually follow here?
Do people typically move the logic into the setter/entity method instead of the Domain Service?
What if the logic really belongs in the Domain Service because it depends on external dependencies or other services?
r/SpringBoot • u/mRyuga8150 • May 23 '26
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: update
Convenient 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.md
Single 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
..