Bird
0
0

Which annotation is used to define a class as an aspect in Spring Boot?

easy📝 Conceptual Q1 of 15
Spring Boot - Aspect-Oriented Programming
Which annotation is used to define a class as an aspect in Spring Boot?
A@Component
B@Aspect
C@Service
D@Controller
Step-by-Step Solution
Solution:
  1. Step 1: Understand aspect declaration

    The @Aspect annotation marks a class as an aspect in Spring Boot.
  2. Step 2: Differentiate from other stereotypes

    Other annotations like @Component or @Service are for beans but not for aspects.
  3. Final Answer:

    @Aspect -> Option B
  4. Quick Check:

    Aspect declaration = @Aspect [OK]
Quick Trick: Use @Aspect to mark aspect classes in Spring Boot [OK]
Common Mistakes:
  • Confusing @Component with @Aspect
  • Using @Service for aspects
  • Forgetting to add @Aspect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes