Spring Framework - using annotations to achieve enhanced exception is thrown, the final enhancement, surround enhancement @AfterThrowing @After @Around

In fact, the previous similar, very similar

// define pointcuts unified
@Pointcut ( "Execution (service.UserService *. * (..))")
public void the pointcut () {

}

 

When an exception occurs simulation program running

 

 

 Running the test method:

 

 The final enhancement:

 

 Others are the same, the final operating results:

 

 Surround enhancements:

 

 

 

 Run the test class:

14:30:38 01-01 [the INFO] aop.UserServiceLogger
- call service.impl.UserServiceImpl@1623b78d the void service.UserService.addNewUser (User) process, process parameters are: [entity.User@4efbca5a]
user information stored database
injected into the user object information are: entity.User@4efbca5a
01-01 14:30:38 [the iNFO] aop.UserServiceLogger
- call service.impl.UserServiceImpl@1623b78d the void service.UserService.addNewUser (user) method, method return value: null

Guess you like

Origin www.cnblogs.com/dongyaotou/p/12128844.html