r/SpringBoot • u/Gotve_ • Jun 07 '25
Question What is the point of using DTOs
I use spring to make my own web application in it but I never used DTOs instead I use models
r/SpringBoot • u/Gotve_ • Jun 07 '25
I use spring to make my own web application in it but I never used DTOs instead I use models
r/SpringBoot • u/Far-Cow-569 • Mar 30 '25
Hey Spring devs! π
As we know, Spring is not integrated in IDEA Community Edition.
Ever found yourself stuck in the endless loop of switching between massive Spring XML configs and Java code, desperately trying to trace bean definitions and references? Yeah, it's soul-crushing.
That's why I built Spring Navigator - a plugin that scratches my own itch and probably yours too.
In short, it lets you navigate freely between all Spring-related elements:
β Spring bean references navigation (super handy!), including:
Navigate to bean references in XML 'ref' attributes
Navigate to injected beans in Java via annotations
Find & navigate to all references from bean declarations (XML or Java annotations)
Auto-suppress "unused" warnings for injected Java properties
β Navigate to bean attributes and methods in XML
β Navigate properties references like ${xxx}
β Quick jump to imported XML files
From reference to declaration


Find all references from declaration Find all references




Honestly, I got tired of Ctrl+F-ing my way through Spring projects. It's especially painful when dealing with legacy projects with tons of XML configs.
I know Spring Boot and annotation-based configs are all the rage now, but let's face it - many enterprise projects still have XML configs or use a mix of XML and annotations. This plugin makes dealing with those scenarios much less painful.
Works with IntelliJ IDEA 2024.3 and above
Install directly from IDEA's plugin marketplace by searching for "Spring Navigator"
Purchase through JetBrains Marketplace or via the plugin's website
The plugin implements various IntelliJ Platform extension points:
fileBasedIndex - Builds an index of Spring beans
psi.referenceContributor - Provides custom reference resolution
codeInsight.lineMarkerProvider - Adds line markers for navigation
referencesSearch - Implements reference search
This is my first commercial plugin, and I'm committed to making it better with every update. Your purchase directly supports ongoing development and improvements.
If you have any suggestions, issues, or ideas, feel free to comment or reach out to me via Email.
If this plugin saves you some headaches, consider giving it a thumbs up or rating it in the IDEA plugin marketplace! It means a lot.
Happy coding! π»
TL;DR: Made a Spring Navigator plugin that lets you jump between bean definitions and references seamlessly. makes Spring development suck less. Upvote if useful!
r/SpringBoot • u/Acceptable-Form8979 • Aug 15 '26
I am a student, looking for Back-end Jobs There is no frontend, as I don't enjoy frontend
r/SpringBoot • u/davebrown1975 • Jun 22 '26
I wanted a focused answer rather than a framework-wide shoot-out: take one realistic blocking endpoint (PostgreSQL through HikariCP + a downstream HTTP call), flipΒ spring.threads.virtual.enabled=true, and measure what actually changes.
Results: ~2,200 β ~13,700 req/s at 2,500 concurrent users, p99 staying under 350ms where platform threads climbed past 6s. The part I found most useful: virtual threads don't make it faster, they move the bottleneck β once Tomcat's thread pool isn't the limit, the connection pool is, and you have to resize it. I also looked at JEP 491 (theΒ synchronizedΒ pinning fix).
Single host, core-pinned, loopback, k6 closed-model, median of 3 reps. Full methodology, raw CSVs, charts and a reproducible repo here:Β https://tucanoo.com/virtual-threads-in-spring-boot-4
r/SpringBoot • u/Rhack2021 • Mar 28 '26
I had a setup with a few microservices (some Spring Boot, some Go) that all needed centralized configuration. Running a full Spring Cloud Config Server meant a JVM instance consuming 200-400MB of RAM just to serve YAML files. So I built a lightweight alternative in Go that returns the exact same propertySources JSON format.
What this means for Spring Boot clients:
Your bootstrap.yml stays the same:
spring:
cloud:
config:
uri: http://config-server:8888
application:
name: myapp
profiles:
active: devThe response from GET /myapp/dev is identical to what Spring Cloud Config Server returns:
{
"name": "application",
"propertySources": [
{
"name": "application",
"source": {
"server.port": "8080",
"spring.datasource.url": "jdbc:mysql://localhost:3306/mydb",
"spring.datasource.username": "root"
}
}
]
}Your Spring Boot app does not know the difference.
What you gain:
~10MB static binary vs ~200MB+ JVM footprint
Starts in milliseconds vs seconds for JVM cold start
~15MB Docker image (Alpine) vs ~300MB+ for Spring Boot
No Java runtime needed on the server
Same config format - drop your YAML files in a folder and serve
What it supports:
Multiple config versions with runtime switching (no restart needed)
YAML auto-flattening to dot-notation properties
Raw file download endpoint
Health check endpoint for load balancers
Hot-reload via fsnotify
Graceful shutdown
What it does NOT support (yet):
Git backend (configs are local files, not pulled from a repo)
Encryption/decryption of property values
Label-based resolution beyond simple versioning
So if you use the Git backend extensively, this is not a drop-in replacement. But if you are serving local YAML files (or can sync them via CI/CD), it works perfectly.
Quick start with Docker:
services:
config-server:
image: ghcr.io/roniel-rhack/config-server-go:1
ports:
- "8888:8888"
volumes:
- ./configs:/opt/packages/config-server/configs
restart: unless-stoppedGitHub: https://github.com/roniel-rhack/config-server-go
MIT licensed, 90%+ test coverage. Curious to hear from other Spring developers - would this fit your use case?
r/SpringBoot • u/leetjourney • Dec 08 '25
Hey, wanted to share with you my new Spring Boot 4 course created for beginners, which by the end of it should take you to a more intermediate level.
You can find it here:
https://youtube.com/playlist?list=PLJce2FcDFtxL-3y86miLr_xLB5FsbK8GJ&si=Apz6SMtwrp7iZ401
Hope at least someone will find it useful!
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:
Hexagonal architecture is overkill until it isn't. With 1 dev and a deadline
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.
2. 18 modules in a monolith is fine. People treat "modular monolith" like a
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.
3. Domain events with u/TransactionalEventListener(phase = AFTER_COMMIT) saved
my sanity. SubscriptionActivatedEvent β listeners in user, notifications,
analytics. Billing doesn't know any of them exist. Plugging in a new listener
is one file.
4. RLS in Postgres + JPA is tricky. JPA's default findById(UUID) is a footgun
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.
5. 20 Flyway migrations isn't a lot but the rules matter. Sequential versions
(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.
6. Webhook idempotency in Redis with TTL = 24h. Key = `idempotency:stripe:{event_id}`.
Stripe retries aggressively. We had real double-billings during the Node.js
era. Never again.
7. The pl/pgSQL function I was going to migrate immediately (computes a weekly
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.
8. Spring Data Redis warns about JPA repositories when it can't classify them.
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/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/Desperate-Gur2200 • Jan 19 '26
Iβm a backend developer with \~4 years of experience in Java and Spring Boot (microservices, REST APIs, DBs, basic cloud). I want to start contributing to real, active open-source projects purely for learning and experience (not looking for paid work).
Iβm looking for:
β’ GitHub orgs or repos that actively accept contributions
β’ Java / Spring Boot based projects with beginner-to-intermediate issues
β’ Communities (Discord/Slack) where people collaborate on building real systemsIβm comfortable with bug fixes, writing tests, improving APIs, and collaborating via PRs.
Goal is to learn, build in public, and grow as a backend engineer.
Any suggestions would be really appreciated. Thanks!
r/SpringBoot • u/moe-gho • Nov 25 '25
once my project gets big I feel like my folders explode. Controllers, services, configs⦠it gets messy. How do you keep a large Spring Boot codebase clean and organized?
r/SpringBoot • u/NordCoderd • Nov 05 '25
Hi Spring-lovers community! Thank you for the warm atmosphere and positive feedback on my previous article on designing entities.
As I promised, I am publishing the next article in the series that provides a detailed explanation of good practices for designing Spring Data JPA repositories.
I will publish the latest part as soon as I finish editing it, if you have something on my to read about Spring technologies, feel free to drop comment and I could write a guide on topic if I have experience with it.
Also, your feedback is very welcome to me. I hope you find this article helpful.
r/SpringBoot • u/Cyphr11 • Jul 26 '25
So I have been learning Linux from boot. Dev and it's tasked based learning have been great for me and I saw there is two courses on backend development one is Python + Go + SQL and other is for Python + TypeScript + SQL one and it's look quite good, so I was thinking if there is any resources similar for Java backend development using spring or springboot, can anyone share best resources for complete java backend I have done Java, Oops, functional programming in java, collection framework, Multithreading and planing to learn Dbms and CN so after that what are the things should I learn Thanks
r/SpringBoot • u/Ok-District-2098 • Apr 22 '25
Almost all JPA methods will eventually generate N+1-like queries, if you want to solve this you will mess up hibernate cache.
findAll() -> will make N additional queries to each parent entity if children is eager loaded, N is the children array/set length on parent entity.
findById()/findAllById() -> the same as above.
deleteAll() - > will make N queries to delete all table entity why can't that just make a simple 'DELETE FROM...'
deleteAllById(... ids) - > the same as above.
CascadeType. - > it will just mess up your perfomance, if CascadeType.REMOVE is on it will make N queries to delete associated entities instead a simple query "DELETE FROM CHILD WHERE parent_id = :id", I prefer control cascade on SQL level.
Now think you are using deleteAll in a very nested and complex entity...
All of those problems just to keep an useless first level cache going on.
r/SpringBoot • u/Anaq42 • Sep 01 '26
When reviewing Java/Spring Boot code, I pay the most attention to I/O calls to see where we are leaving the process and potentially "slowing down" the application. This would involve following a call through several methods to find out whether it eventually reached a repository, HTTP client, or any other I/O invocation.
I built an IntelliJ plugin called Lattency to make that visible in the editor.
It adds gutter markers for database, HTTP, messaging, and file I/O. It also follows calls through project code, so methods that reach I/O transitively are marked with a dimmed version of the relevant icon.
Hovering over a marker shows the complete sink chain, and clicking it lets you navigate to any method along that chain.
The analysis is entirely static. It does not run the application, make network requests, or collect telemetry. Common Java and Spring APIs work without configuration, and project-specific clients can be described in a committed lattency.yml.
It is free and open source:
Marketplace: https://plugins.jetbrains.com/plugin/33937-lattency
GitHub: https://github.com/josipmusa/lattency
It currently supports Java projects in IntelliJ IDEA 2025.2 and newer. Kotlin is not supported yet.
r/SpringBoot • u/dpk_s2003 • Jan 25 '26
Day 9 of building a production-ready Spring Boot backend π
Today I focused on one of the most important backend concepts: proper exception handling. Instead of letting unwanted stack traces or default error pages reach the client, I implemented a centralized exception handling mechanism to return clean, meaningful, and consistent error responses.
What I implemented today:
Created a Global Exception Handler using @ControllerAdvice
Added a Generic Exception class for handling unexpected errors
Added a Resource Not Found Exception for missing users or listings
Mapped exceptions to proper HTTP status codes (400, 404, 409, 500)
Integrated exception handling directly into the service layer
Returned structured error responses (status, message, timestamp) instead of raw errors Verified everything using Postman, including user create, fetch, and failure scenarios. This approach helps keep APIs clean, predictable, and frontend-friendly, which is essential for real-world applications.
Iβm documenting the complete backend journey step by step on my YouTube channel. The link is available in my Reddit profile bio. As always, feedback or suggestions on improving exception handling are welcome π
r/SpringBoot • u/Jinkaza772 • Jan 04 '26
I have created one api endpoint for the user registration, and while I made it I found few points like in which layer sanitization should be done (client -> controller -> service -> repository -> database) then I came to know about DTO. on We can use DTO object for parsing the user request data and apply sanitization and proper checks and then we can use response DTO as well to send back the response to the client.
Well I am learning springboot, and different tutorials are doing different things, so I want to know from you guys. What should be the proper structure here and using DTO layer is really still being used in today industry ?
r/SpringBoot • u/Gold_Opportunity8042 • Oct 13 '25
Hey guys,
I recently created a Java microservices project that includes an API Gateway, Service Registry, Auth Service, and other application-related services. When I was working with a monolithic architecture, JWT token creation and validation was simpler since everything was in a single place. Later, I realized that in a microservices setup, I can't just rely on a separate Auth Service to handle all authentication and authorization tasks due to multiple barriers.
What I did was that i wrote the login/signup functionality in the Auth Service, while authentication and authorization are handled in the API Gateway by verifying JWT tokens using a Redis cache, implemented via a filter in the API Gateway.
However, I feel this might not be the approach typically used in the industry. Can someone confirm this and suggest alternative architectures? Also, how common is it for industries to use tools like Keycloak? And is it generally better to use external tools for security, or is it wise to build our own security architecture?
Thank you
r/SpringBoot • u/michalkmiecik • Aug 28 '25
Has anyone used Spring Webflux to create an online game server? (tomcat is not a good idea)
For over six months now, I was building an MMORPG in my spare time, and when I initially did my research, most people recommended JS frameworks for building a server.
I'm a Java developer, and I decided it would be interesting to use technologies I'm familiar with.
Conclusion?
Everything's working great so far; the code is easy and enjoyable to develop thanks to the use of design patterns and clean architecture, and if the project evolves, I have a ton of monitoring tools and other tools from the JVM world.
r/SpringBoot • u/Jaded-Piccolo-4678 • Aug 16 '25
If a user logs in he got a JWT that he will use for every REQUEST, but imagine before the first token expires if he logs out then logs in again he will get a new token, how can we make the old token unvalid since we don't store it the DB?
r/SpringBoot • u/danielliuuu • May 27 '25
I'm excited to announce the release of HttpExchange Spring Boot Starter 3.5.0 - a Spring Boot starter that makes working with Spring 6's HttpExchange annotation.
Spring 6 introduced the @HttpExchange annotation for creating declarative HTTP clients, but it lacks the auto-configuration. This starter bridges that gap by providing:
β¨ Auto-configuration: Auto-configuration for @HttpExchange clients
π Full Compatibility: Works with Spring Web annotations (e.g., @RequestMapping, @GetMapping), so you can migrate seamlessly from Spring Cloud Openfeign
ποΈ Flexible Configuration: Global, connection-level (channel), and client-specific settings
π Dynamic Refresh: Change configuration without restarting (with Spring Cloud Context)
βοΈ Load Balancing: Built-in support for Spring Cloud LoadBalancer
π Multiple Client Types: Support for both RestClient and WebClient
This library is designed to keep migration costs to a minimum, whether youβre migrating into HttpExchange Spring Boot Starter or migrating out to another implementation.
// com/example/api/UserApi.java
@HttpExchange("/users")
interface UserApi {
@GetExchange("/{userId}")
User getUser(@PathVariable Long id);
@PostExchange
User createUser(@RequestBody User user);
}
@SpringBootApplication
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class)
.properties("http-exchange.base-packages=com.example.api") // Configure base package for auto register clients
.properties("http-exchange.base-url=https://api.example.com") // Configure default base url
.run(args);
}
@Bean
ApplicationRunner runner(UserApi userApi) { // Just use it like a normal bean
return args -> {
User user = userApi.getUser(1L);
System.out.println("User: " + user.getName());
};
}
}That's it! No additional classes in your codebase.
Dropped backward compatibility with Spring Boot < 3.5.0 due to extensive internal refactoring in Spring Boot 3.5.0, if you're using a Spring Boot version < 3.5.0, please stick with version 3.4.x.
Removed deprecated features: RequestConfigurator, Requester, and REST_TEMPLATE client type
Enhanced redirects configuration support at channel level
Cleaner codebase with removal of hacky implementations
r/SpringBoot • u/[deleted] • Mar 14 '25
I am planning to add a login page to the project i developed . To do this i need to explore spring security .can somebody help. Me to find the better resource
r/SpringBoot • u/themasterengineeer • Feb 26 '25
Came across this today as I wanted to prepare a new portfolio project and learn about microservices.
Itβs actually quite easy to follow and build a whole system based on microservices architecture, I think people here will find it useful.
https://youtu.be/-pv5pMBlMxs?si=0-u_66n_eNx1tCJx
Here are main topics covered: Java 21 Spring Boot Kafka Flyway DB migration SQL schema Circuit Breaker API Gateway Authentication using Keycloak Swagger docs
r/SpringBoot • u/Tanino87 • Dec 22 '24
Hey SpringBoot Reddit!
Iβve just written a quick article on how I built a simple event notification pattern with Spring Data and JPA. It uses Entity Listeners to detect changes at the persistence layer and Spring Events to propagate them across the app.
Check it out here: Lightweight Event Notification Pattern
Have you used similar patterns in your projects? Any tips or ideas for improvement? Would love to hear your thoughts!
Cheers!