Logging and auditing service methods
Aspect-Object Programming (AOP) is known in many applications as an immediate solution for logging or auditing. This first recipe will introduce the concept and components of AOP in Spring 5.0 as it implements the service logging and auditing features of an MVC application through the use of the Log4J framework.
Getting started
Create a new Eclipse Maven project, ch05
, with the web.xml-lessServletContext
declaration. Add all the previous libraries of Spring 5.0, Servlet 3.1, JSP 2.3, JUnit 4, and other related plugins to the Maven configuration. Follow Chapter 1, Getting Started with Spring, for building the context definitions.
How to do it...
Before implementing AOP components, let us first implement logging by following these steps:
- The previous has already created some POJOs, so just copy the
Employee
model, the supporting DAO and service interfaces, and their corresponding implementation classes. Place all model classes in a new package,org.packt.aop...