Spring AOP (Aspect-Oriented Programming) Flashcards

1
Q

What is Aspect-Oriented Programming (AOP) in Spring?

A

A programming paradigm that allows separation of cross-cutting concerns, such as logging and transaction management, from business logic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a JoinPoint in Spring AOP?

A

A point in the application execution, such as method execution, where an aspect can be applied.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Pointcut in Spring AOP?

A

A set of JoinPoints where an advice (code) should be executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an Advice in Spring AOP?

A

Action taken by an aspect at a particular join point, such as before, after, or around method execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is @Aspect in Spring AOP?

A

An annotation to declare a class as an aspect, which contains advice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Proxy in Spring AOP?

A

An object that acts as a substitute for another object and intercepts method calls, usually used to apply aspects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does @Before advice work in Spring AOP?

A

It executes before the target method is invoked.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does @AfterReturning advice work in Spring AOP?

A

It runs after the target method has successfully returned a result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of @Around advice in Spring AOP?

A

It surrounds a method execution, allowing you to run code both before and after the method execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you declare a pointcut expression in Spring AOP?

A

Using an expression like execution(* com.example.service..(..)) inside @Pointcut.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly