/** * Pointcut that matches all repositories, services and Web REST endpoints. */ @Pointcut("(within(com.springio.store.repository..*) && @annotation(org.springframework.stereotype.Repository))"+ " || (within(com.springio.store.service..*) && @annotation(org.springframework.stereotype.Service))"+ " || (within(com.springio.store.web.rest..*) && @annotation(org.springframework.web.bind.annotation.RestController))") public void loggingPointcut() { // Method is empty as this is just a Pointcut, the implementations are in the advices. }
/** * Pointcut that matches all repositories, services and Web REST endpoints. */ @Pointcut("within(@org.springframework.stereotype.Repository *)" + " || within(@org.springframework.stereotype.Service *)" + " || within(@org.springframework.web.bind.annotation.RestController *)") public void springBeanPointcut() { // Method is empty as this is just a Pointcut, the implementations are in the advices. }
@Pointcut("execution(public * *(..))" + " && !execution(String *.toString())" + " && !execution(int *.hashCode())" + " && !execution(boolean *.canEqual(Object))" + " && !execution(boolean *.equals(Object))") protected void publicMethod() { }
/** * Pointcut that matches all Spring beans in the application's main packages. */ @Pointcut("within(io.github.pascalgrimaud.qualitoast.repository..*)"+ " || within(io.github.pascalgrimaud.qualitoast.service..*)"+ " || within(io.github.pascalgrimaud.qualitoast.web.rest..*)") public void applicationPackagePointcut() { // Method is empty as this is just a Pointcut, the implementations are in the advices. }
private List<Method> getAdvisorMethods(Class<?> aspectClass) { final List<Method> methods = new LinkedList<Method>(); ReflectionUtils.doWithMethods(aspectClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException { // Exclude pointcuts if (AnnotationUtils.getAnnotation(method, Pointcut.class) == null) { methods.add(method); } } }); Collections.sort(methods, METHOD_COMPARATOR); return methods; }
/** * Find and return the first AspectJ annotation on the given method * (there <i>should</i> only be one anyway...) */ @SuppressWarnings("unchecked") protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) { Class<?>[] classesToLookFor = new Class<?>[] { Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class}; for (Class<?> c : classesToLookFor) { AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) c); if (foundAnnotation != null) { return foundAnnotation; } } return null; }
@Pointcut("execution(* *.*(..))") public void anyMethod() { //pointcut }
@Pointcut("execution(@com.app.annotation.aspect.DbRealm * *(..))")//方法切入点 public void methodAnnotated() { }
@Pointcut("execution(public * com.mi.module.*.controller..*.*(..))") public void webLog(){}
@Pointcut("execution(@com.app.annotation.aspect.MemoryCache * *(..))")//方法切入点 public void methodAnnotated() { }
@Pointcut("execution(@com.app.annotation.aspect.SingleClick * *(..))")//方法切入点 public void methodAnnotated() { }
@Pointcut("execution(@com.app.annotation.aspect.CheckLogin * *(..))")//方法切入点 public void methodAnnotated() { }
/** * Matches any execution of a method */ @Pointcut("execution(* *(..))") public void anyMethod() { }
@Pointcut(POINTCUT_METHOD) public void methodAnnotatedWithHookMethod() { }
@Pointcut("execution(@com.app.annotation.aspect.TimeLog *.new(..))")//构造器切入点 public void constructorAnnotated() { }
@Pointcut("execution(public * com.ijinshan.*.web.*.*(..))") private void errorPointCutMethod() { }
@Pointcut(value="execution(* com.packt.ch03.dao.BookDAO.addBook(com.packt.ch03.beans.Book))") public void selectAdd(){}
@Pointcut("execution(public * com.ijinshan.sjk.service.impl.AppServiceImpl.update*(..))") private void updateAppPointcut() { }
@Pointcut("execution(android.support.v4.app.FragmentActivity+.new()) && annotatedWithPuppet()") public void construct() { }
@Pointcut("(anyRestControllerAnnotated() || anyControllerAnnotated()) && anyPublicMethodReturningCallable()") private void anyControllerOrRestControllerWithPublicAsyncMethod() { }
/** * Pointcut that matches all repositories, services and Web REST endpoints. */ @Pointcut("within(org.jhipster.blog.repository..*) || within(org.jhipster.blog.service..*) || within(org.jhipster.blog.web.rest..*)") public void loggingPointcut() { // Method is empty as this is just a Pointcut, the implementations are in the advices. }
@Pointcut("@within(com.safframework.aop.annotation.Async)||@annotation(com.safframework.aop.annotation.Async)") public void onAsyncMethod() { }
/** * Matches any method, which is annotated with {@link Transactional} */ @Pointcut("@annotation(io.mcarle.strix.annotation.Transactional)") public void transactionalAnnotated() { }
@Pointcut("execution(@android.support.annotation.UiThread * *(..)) || methodInsideAnnotatedType()") public void method() { }
@Pointcut("execution(* org.ibase4j.provider..*.*(..))") public void aspect() { }
@Pointcut("execution(* ru.technoserv.controller.EmployeeController.getDepartmentStuff(..))") public void getStuff(){ //pointcut }
@Pointcut("execution(@android.support.annotation.WorkerThread * *(..)) || methodInsideAnnotatedType()") public void method() { }
@Pointcut("execution(* android.support.v4.app.FragmentActivity+.onDestroy(..)) && annotatedWithPuppet()") public void onDestroy() { }
/** * 切入点 */ @Override @Pointcut("execution(* org.eddy.dao.mapper..*(..))") public void mapperCheckPoint() { }
@Pointcut("execution(public * com.peony.readinglist.controller.ReadingListController.*(..))") public void log() { }
@Pointcut("target(org.springframework.data.repository.Repository)") void allRepositories() {}
@Pointcut("execution(* com.titizz.shorturl.web.controller.*Controller.*(..))" + "&& @annotation(org.springframework.web.bind.annotation.RequestMapping))") public void requestRecord() {}
@Pointcut("within(@org.springframework.stereotype.Controller *))") public void classPointcut() {}
@Pointcut("execution(* org.packt.aop.transaction.controller.LoginController.login(..))") public void loginPointcut() {}