Skills101
← All practice quizzes

Quiz: Spring AOP and Proxies

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Annotations such as @Transactional, @Cacheable and @Async work because Spring wraps your bean in a proxy. Learn the AOP vocabulary, see a proxy built in plain Java, write an @Around aspect, and understand why calling a method on this skips the annotation.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    Who actually begins and commits the transaction for a @Transactional service method?

  2. Question 2

    In AOP, what is a pointcut?

  3. Question 3

    What does this print?

    import java.lang.reflect.*;
    
    interface Greeter { String greet(String name); }
    
    public class Main {
        public static void main(String[] args) {
            Greeter real = name -> "Hello " + name;
            Greeter proxy = (Greeter) Proxy.newProxyInstance(
                    Greeter.class.getClassLoader(), new Class<?>[]{Greeter.class},
                    (p, m, a) -> ((String) m.invoke(real, a)).toUpperCase());
            System.out.println(proxy.greet("asha"));
        }
    }
    
  4. Question 4

    Spring Boot uses CGLIB proxies by default. What does a CGLIB proxy do?

  5. Question 5

    A @Transactional annotation is placed on a private method. What happens?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →