Aspect-Oriented Programming (AOP) in Spring Boot

    Question 1SPRING BOOT AOP - Core Concept

    What is the main purpose of AOP in Spring Boot?

    Question 2SPRING BOOT AOP - Key Terminology

    In Spring AOP, what does the term Join Point refer to?

    Question 3SPRING BOOT AOP - Advice Types

    Which of the following is not a valid advice type in Spring AOP?

    Question 4SPRING BOOT AOP - Code Snippet (Before Advice)

    What does this aspect do?

    @Aspect @Component public class LoggingAspect { @Before("execution(* com.example.service.UserService.*(..))") public void logBefore() { System.out.println("Before method in UserService"); } }

    Question 5SPRING BOOT AOP - Pointcut Expressions

    Which pointcut expression matches all methods in all classes under com.app.repository package?

    Question 6SPRING BOOT AOP - Code Snippet (Around Advice)

    What does this @Around advice do?

    @Around("execution(* com.example.service.PaymentService.*(..))") public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable { long start = System.currentTimeMillis(); Object result = joinPoint.proceed(); long end = System.currentTimeMillis(); System.out.println("Execution time: " + (end - start) + " ms"); return result; }

    Question 7SPRING BOOT AOP - Code Snippet (AfterThrowing)

    What is the purpose of this advice?

    @AfterThrowing( pointcut = "execution(* com.example.service.OrderService.*(..))", throwing = "ex") public void logException(Exception ex) { System.out.println("Exception caught: " + ex.getMessage()); }

    Question 8SPRING BOOT AOP - Proxy Mechanism

    How does Spring AOP implement aspects internally by default?

    Question 9SPRING BOOT AOP - Aspect Ordering

    If multiple aspects apply to the same join point, how can their execution order be controlled?

    Question 10SPRING BOOT AOP - Code Snippet (Reusing Pointcut)

    What does the following code achieve?

    @Pointcut("execution(* com.example.controller.*.*(..))") public void controllerMethods() {} @Before("controllerMethods()") public void logBeforeController() { System.out.println("Controller method invoked"); }