From the course: Spring: Framework in Depth

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Implement AOP advice: Around

Implement AOP advice: Around

From the course: Spring: Framework in Depth

Start my 1-month free trial

Implement AOP advice: Around

- [Instructor] So we've seen the Before and we've seen the After Returning and we talked a little bit about the After Throwing. So now we're going to take a look at the Around Advice, which is the one that I use most often because this gives me the most flexibility as well as controls a lot of various situations. And the reality is often when I'm applying Advice, I need the preconditions as well as postconditions. And a lot of times I put timing in there as well, to get some concept of how long that method took to execute. So let's take a look at implementing an Around Advice. All right, so let's jump back into our logging aspect and let's change this to @Around. And in doing so, we'll get rid of the returning statements. Now when you are doing this, you need to do a couple things different. You can no longer return a void, you need to return an object and it's no longer just a join point, now it is a proceeding join point.…

Contents