O'Reilly logo

Spring Security Essentials by Nanda Nachimuthu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple AOP examples

Here are the steps to run basic AOP samples that will explain the AfterAdvice, BeforeAdvice, AroundAdvice, and ExceptionAdvice concepts.

Create a Spring Maven project in STS and add the BookService class:

Simple AOP examples

Create AOPBeforeMethod.java and attach BeforeAdvice to BookService.java as configured in the Spring-Book.xml:

Simple AOP examples

From the config file, you can understand that we are creating a bean for the BeforeMethod class and proxy bean for BookService. The target tag specifies the bean that needs to be applied with the Aspect. The interceptorNames ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required