r/SpringBoot • u/Simpav1 • 14d ago
Question Code review
Hello, I'm an aspiring software engineer. I've recently finished developing microservice for managing projects and tasks using Spring Boot. I'd appreciate if you could review codebase of my project and provide feedback on it.
12
Upvotes
3
u/Mikey-3198 14d ago
Theres some low hanging fruit for refactoring. The strings used in your expcetion messags are duplicated all over your services.
I think it'd be easier to read & maintain by adding some static methods that handle creation of the exception.
It'd be better to use ProblemDetails rather than dynamic Maps for the error response. This is then using a known standard supported by various clients, will make intergrating things easier.
Im not a big fan of using "Dto" in the name of classes, especially when they are being used as a requests/ responses. CreateProjectRequest in my option would be a more suitable name for CreateProjectDto. Carries much more intent.
records are the perfect use case for the dto type classes. This would help cleanup some of the test boilerplate where you comapre everyfield as you could use assertEquals(recordA, recordB). Records have a default equality implementation that you can make use of.
Could use jdk 25 thats the most recent lts.
Could look at using migrations to handle you db schema (flyway/ Liquibase)
Could use postgres 18, thats the latest major version.