Spring Boot: Intermediate Custom Annotations & AOP Techniques
Explore intermediate concepts of custom annotations and AOP in Spring Boot.
Questions in this quiz
12 questions on Spring Boot: Intermediate Custom Annotations & AOP Techniques. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of custom annotations in Spring Boot?
- ATo replace configuration files
- BTo manage database transactions
- CTo add metadata to Java code
- DTo handle exceptions
2.Which of the following is a correct way to define a custom annotation in Java?
- Apublic class MyAnnotation {}
- Bpublic @MyAnnotation {}
- C@interface MyAnnotation {}
- D@MyAnnotation class {}
3.In Spring AOP, what is a 'Join Point'?
- AA specific exception thrown
- BA configuration file
- CA point during the execution of a program
- DA method that is advised
4.Which annotation is used to define a pointcut expression in Spring AOP?
- A@Pointcut
- B@After
- C@Aspect
- D@Before
5.What is the role of the @Aspect annotation in Spring Boot?
- ATo configure transactions
- BTo handle exceptions
- CTo mark a class as an aspect
- DTo define a pointcut
6.Which of the following is NOT a type of advice in Spring AOP?
- AAround
- BInside
- CBefore
- DAfter
7.How can you access method parameters within an advice in Spring AOP?
- AUsing the Aspect object
- BUsing the Advice object
- CUsing the JoinPoint object
- DUsing the Pointcut object
8.What is the purpose of the @Around advice in Spring AOP?
- ATo execute code only before a method
- BTo execute code before and after a method
- CTo execute code only after a method
- DTo execute code during exception handling
9.Which Spring Boot feature allows you to automatically apply advice to beans?
- AAspectJ
- BSpring Data
- CSpring Security
- DSpring MVC
10.What is the main benefit of using AOP in Spring Boot?
- ASeparation of cross-cutting concerns
- BImproved database performance
- CEnhanced security
- DFaster application startup
11.Which of the following is a valid pointcut expression in Spring AOP?
- Acall(* com.example.service.*.*(..))
- Binvoke(* com.example.service.*.*(..))
- Cexecution(* com.example.service.*.*(..))
- Drun(* com.example.service.*.*(..))
12.How do you enable AspectJ support in a Spring Boot application?
- AAdd @EnableAspectJAutoProxy to a configuration class
- BAdd @EnableSpringBoot to a configuration class
- CAdd @EnableAOP to a configuration class
- DAdd @EnableProxy to a configuration class