Guest User

Untitled

a guest
Feb 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. package _04aspectj.test;
  2.  
  3. import org.springframework.context.ApplicationContext;
  4. import org.springframework.context.support.ClassPathXmlApplicationContext;
  5.  
  6. import _04aspectj.service.EmployeeService;
  7.  
  8. public class AspectJTest {
  9.  
  10. public static void main(String[] args) {
  11.  
  12. ApplicationContext context = new ClassPathXmlApplicationContext("aspectj.xml");
  13.  
  14. EmployeeService empService = context.getBean("employeeService", EmployeeService.class);
  15.  
  16. // aop:before
  17. empService.saveEmployee();
  18. System.out.println("---");
  19.  
  20. // aop:after
  21. empService.updateEmployee();
  22. System.out.println("---");
  23.  
  24. // aop:after-returning
  25. empService.getEmployeeId();
  26. System.out.println("---");
  27.  
  28. // aop:after-throwing
  29. try {
  30. empService.deleteEmployee();
  31. } catch (Exception e) {
  32. }
  33. System.out.println("---");
  34.  
  35. // aop:around
  36. empService.getAllEmployees();
  37.  
  38. }
  39.  
  40. }
Add Comment
Please, Sign In to add comment