From the course: Spring: Framework in Depth
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Building your own aspect
From the course: Spring: Framework in Depth
Solution: Building your own aspect
(upbeat music) - [Instructor] Now that you have had your chance, it's time forme to show you my solution to this challenge exercise. I choose to solve this aspect through an annotation. I created an annotation called countable and I created a corresponding aspect for it. So, I created a logger called LIL Application Counter for LinkedIn Learning Application Counter. I created an internal map element aspect to hold both the method name and an integer for the number of times it was counted. And that's on line 20. I then created my point cut, which looked for that annotation countable on line 22. Then, I went ahead and did a before on this one because all I care about is that the method was called. There was no requirements about that it returned, it returned data. None of that mattered. So, what I care about is that it was called. And I just want to simply get the name of it. And I'm building the name in such a way…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Aspecting in Spring4m 51s
-
(Locked)
Define aspect-oriented programming (AOP) pointcuts6m 6s
-
(Locked)
Implement AOP advice: Before5m 9s
-
(Locked)
Implement AOP advice: After2m 40s
-
(Locked)
Implement AOP advice: Around4m 40s
-
(Locked)
Challenge: Building your own aspect53s
-
(Locked)
Solution: Building your own aspect2m 41s
-
-