diff --git a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/aop/LoggingAspect.java b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/aop/LoggingAspect.java index fbdc71f..26dc69c 100644 --- a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/aop/LoggingAspect.java +++ b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/aop/LoggingAspect.java @@ -13,6 +13,13 @@ public class LoggingAspect { private final ExceptionLogRepository exceptionLogRepository; + /** + * Measures and logs the execution time of controller methods in the specified package. + * + * @param joinPoint the join point representing the intercepted method + * @return the result of the intercepted method execution + * @throws Throwable if the intercepted method throws any exception + */ @Around("execution(* in.newdevpoint.bootcamp.controller.*.*(..))") // Pointcut expression public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { long startTime = System.currentTimeMillis(); @@ -26,11 +33,17 @@ public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { return proceed; } + /**** + * Logs a message before any method execution in the UserService class. + */ @Before("execution(* in.newdevpoint.bootcamp.service.UserService.*(..))") // Pointcut expression public void logBeforeMethod() { System.out.println("Before method execution"); } + /** + * Logs a message after the execution of any method in the UserService class. + */ @After("execution(* in.newdevpoint.bootcamp.service.UserService.*(..))") public void logAfterMethod() { System.out.println("After method execution"); diff --git a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserAlreadyExistsException.java b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserAlreadyExistsException.java index 4ce9372..4f53d42 100644 --- a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserAlreadyExistsException.java +++ b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserAlreadyExistsException.java @@ -1,6 +1,11 @@ package in.newdevpoint.bootcamp.exceptions; public class UserAlreadyExistsException extends RuntimeException { + /** + * Constructs a new exception indicating that a user already exists. + * + * @param message the detail message explaining the exception + */ public UserAlreadyExistsException(String message) { super(message); } diff --git a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserNotFoundException.java b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserNotFoundException.java index 9c8b786..193f0c7 100644 --- a/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserNotFoundException.java +++ b/spring-boot-bootcamp/src/main/java/in/newdevpoint/bootcamp/exceptions/UserNotFoundException.java @@ -1,6 +1,11 @@ package in.newdevpoint.bootcamp.exceptions; public class UserNotFoundException extends RuntimeException { + /** + * Constructs a new UserNotFoundException with the specified detail message. + * + * @param message the detail message explaining the reason for the exception + */ public UserNotFoundException(String message) { super(message); }