r/SpringBoot • u/AlarmOpening2062 • Mar 01 '26
Discussion E-commerce with Spring Boot
Hello everyone, I hope you're all doing well. I'm writing to ask for your support for this project I'm sharing here. Whether it's by submitting an issue, a PR, or giving a star, this is my first big project. Thank you all!
28
Upvotes
View all comments
Show parent comment
2
u/AlarmOpening2062 Mar 04 '26
Thank you so much for your detailed and thoughtful feedback — I really appreciate you taking the time to review the code and point out these important issues.
You're absolutely right about the transaction boundaries: currently, I'm relying on Spring's default behavior (and unfortunately, Open Session in View), which is not ideal for data consistency or performance. I plan to refactor the service layer to use u/Transactional at the method level, so each business operation (like adding to cart) runs in a single, consistent transaction.
Regarding business logic in controllers: you’re 100% correct. Sending emails and handling image uploads should live in services, not controllers. That’s already on my roadmap as I move toward a cleaner separation of concerns.
The DTO vs Entity point is also spot-on. Right now, I’m using entities directly in Thymeleaf templates, which can lead to lazy-loading issues and over-fetching. I’ll introduce DTOs soon to expose only what’s needed.
And yes — the cart model is indeed inconsistent (
CARTvsORDER_ITEM). I’ll unify it with a properCartItementity to reflect the real domain.This project is a learning journey, and feedback like yours helps me grow as a developer. Thanks again