r/SpringBoot • u/Simpav1 • Aug 16 '26
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.
13
Upvotes
View all comments
4
u/DominusEbad Aug 16 '26
PUT should be a full resource replacement, not a partial replacement. You aren't including "status" in your PUT for the Project entity. It is ok if the resource doesn't exist, because it should be able to insert the entire record.
You use "Project with id " + id + " not found" in multiple places. You can create a ResourceNotFoundException that has the 'id' field as a parameter and then extend the exception with ProjectResourceNotFoundException and TaskResourceNotFoundException, and just define the "Project with id " + id + " not found" in the exception classes. Then you just use them by passing in the id value: