日期:2014-05-17 浏览次数:20755 次
package com.aa.spring; public interface UserManager { public void addUser(String username, String password); public void deleteUser(int id); public void modifyUser(int id, String username, String password); public String findUserById(int id); }
package com.aa.spring; public class UserManagerImpl implements UserManager { public void addUser(String username, String password) { System.out.println("------UserManagerImpl.addUser---------"); } public void deleteUser(int id) { System.out.println("------UserManagerImpl.deleteUser---------"); } public String findUserById(int id) { System.out.println("------UserManagerImpl.findUserById---------"); return null; } public void modifyUser(int id, String username, String password) { System.out.println("------UserManagerImpl.modifyUser---------"); } }
package com.aa.spring; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; @Aspect public class Hanlder { @Pointcut("execution(* add*(..))") private void allMethod() { }; @Before("allMethod()") private void check() { System.out.println("-------check------"); } }