r/SpringBoot • • Dec 28 '25

Question Feedback for my Spring Boot project

https://github.com/tonysalinas-futdev/JavaEcomercceAPI

I'm building an e-commerce API for my portfolio. It's my first time working with Spring Boot, as I usually use Python and FastAPI. I'm also trying to make it as comprehensive as possible, using a global exception handler, DTOs, mappers, logging, custom exceptions, a modular architecture, and running tests. I welcome feedback on what I could improve.

14 Upvotes

34 comments sorted by

View all comments

Show parent comment

1

u/MaDpYrO Dec 30 '25

Your exception is called DatabaseException.

Your service layer encapsulates your database logic, etc - it should not throw exceptions that aren't service logic, you are exposing an implementation detail

1

u/Tony_salinas04 Dec 30 '25

And how should it be? I had that custom exception precisely to avoid throwing one from the repository.

1

u/MaDpYrO Jan 04 '26

It should be a business exception, not a database one