Skip to content

4x2vk/spring-advanced

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Framework

Spring Advanced

A backend service built with Spring Boot, designed to manage authentication, task operations, and user interactions.

Project Overview

This repository was initialized and debugged from a broken state. The application now runs successfully after resolving multiple critical issues across configuration, logic, and testing layers.

Completed Tasks

Level Task Description
Lv 0 Fixed application startup errors and configuration issues
Lv 1 Restored and re-implemented AuthUserArgumentResolver
Lv 2 Refactored service logic for early returns, removed unnecessary else blocks, and moved password validation to DTO
Lv 3 Resolved N+1 query problem using @EntityGraph in TodoRepository
Lv 4 Corrected and improved test cases across multiple services

Built With

JDK 17 Spring Boot 3.3.3 Spring Data JPA MySQL Lombok Spring Security Crypto Spring Boot Validation JUnit Mockito BCrypt JJWT


♻ Key Improvements

Error Resolution

  • Fixed multiple startup errors including misconfigured beans and missing dependencies.
  • Added application.yml with proper JWT key setup.

ArgumentResolver

  • Re-implemented AuthUserArgumentResolver to correctly inject authenticated user context into controller methods.

Code Refactoring

  • Early Return Logic: Prevented unnecessary password encoding by checking for duplicate emails first.
  • Simplified Conditionals: Removed nested else blocks for better readability in WeatherClient.
  • Validation Shift: Moved password validation logic from service layer to DTO using annotations like @Size, @Pattern and @NotBlank.

Performance Optimization

  • Replaced JPQL fetch join with @EntityGraph to resolve N+1 query issues in TodoService.

Test Coverage

Fixed broken test cases:

  • PassEncoderTest now correctly verifies password matching.
  • ManagerServiceTest and CommentServiceTest updated to reflect correct exception handling.
  • Renamed misleading test method names to match actual behavior.
  • Adjusted service logic to ensure tests pass under updated conditions.

About

This repository was initialized and debugged from a broken state

Topics

Resources

Stars

Watchers

Forks

Languages

  • Java 100.0%