Spring Boot: Custom Annotations & AOP Mastery
Assess your understanding of custom annotations and AOP in Spring Boot.
Questions in this quiz
12 questions on Spring Boot: Custom Annotations & AOP Mastery. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of using custom annotations in Spring Boot?
- ATo improve application performance
- BTo add metadata to Java code
- CTo handle exceptions globally
- DTo manage database transactions
2.Which of the following is a correct way to define a custom annotation in Java?
- Apublic @annotation MyAnnotation {}
- B@interface MyAnnotation {}
- Cpublic @interface MyAnnotation()
- Dpublic class MyAnnotation {}
3.In Spring AOP, what is a 'join point'?
- AA point during the execution of a program
- BA configuration file for AOP
- CA method annotated with @Aspect
- DA class that contains advice
4.Which annotation is used to define an aspect in Spring AOP?
- A@Advice
- B@Pointcut
- C@Aspect
- D@JoinPoint
5.What is the role of a 'pointcut' in Spring AOP?
- ATo execute business logic
- BTo manage transactions
- CTo define where advice should be applied
- DTo handle exceptions
6.Which advice type is executed after a method returns successfully in Spring AOP?
- A@AfterThrowing
- B@Around
- C@AfterReturning
- D@Before
7.How can you retrieve the method name in an advice using Spring AOP?
- AUsing JoinPoint.getMethodName()
- BUsing JoinPoint.getName()
- CUsing JoinPoint.getSignature().getName()
- DUsing JoinPoint.getMethod()
8.Which of the following is NOT a valid advice type in Spring AOP?
- A@Around
- B@After
- C@Before
- D@During
9.What is the purpose of the @Retention annotation when creating custom annotations?
- ATo document the annotation
- BTo specify how long the annotation should be retained
- CTo apply the annotation at runtime
- DTo define the target of the annotation
10.Which element of a custom annotation specifies where the annotation can be applied?
- A@Target
- B@Retention
- C@Inherited
- D@Documented
11.In Spring AOP, what is the purpose of the @Around advice?
- ATo execute code only after a method
- BTo execute code only before a method
- CTo execute code before and after a method
- DTo handle exceptions
12.Which annotation is used to indicate that a custom annotation should be documented by Javadoc?
- A@Target
- B@Inherited
- C@Documented
- D@Retention