List of usage examples for org.springframework.aop.support.annotation AnnotationMatchingPointcut AnnotationMatchingPointcut
public AnnotationMatchingPointcut(@Nullable Class<? extends Annotation> classAnnotationType, @Nullable Class<? extends Annotation> methodAnnotationType)
From source file:fr.norad.jaxrs.oauth2.core.tck.spring.Hibernate5MethodValidationPostProcessor.java
public void afterPropertiesSet() { this.advisor = new DefaultPointcutAdvisor(new AnnotationMatchingPointcut(Validated.class, true), new Hibernate5MethodValidationInterceptor()); }
From source file:prospring3.ch5.beanpostprocessor.DeassociatePointcutAdvisor.java
private Pointcut buildPointcut(Set<Class<? extends Annotation>> deassociateAnnotationTypes) { ComposablePointcut result = null;/*from ww w .j a va 2s. co m*/ for (Class<? extends Annotation> deassociateAnnotationType : deassociateAnnotationTypes) { Pointcut mpc = new AnnotationMatchingPointcut(null, deassociateAnnotationType); if (result == null) { result = new ComposablePointcut(mpc); } else { result.union(mpc); } } return result; }
From source file:dk.clanie.actor.ActorAnnotationAdvisor.java
/** * Create a new ActorAnnotationAdvisor using the given task executor. * /* w w w .j av a 2 s . com*/ * @param executor the task executor to use for asynchronous methods */ public ActorAnnotationAdvisor(Executor executor) { Set<Class<? extends Annotation>> asyncAnnotationTypes = new LinkedHashSet<Class<? extends Annotation>>(2); asyncAnnotationTypes.add(Actor.class); this.advice = buildAdvice(executor); this.pointcut = new AnnotationMatchingPointcut(Actor.class, true); }
From source file:org.pshow.ecm.security.MethodAuditPostProcessor.java
@Override public void afterPropertiesSet() throws Exception { Pointcut pointcut = new AnnotationMatchingPointcut(this.auditAnnotationType, true); Advice advice = new MethodAuditInterceptor(); this.advisor = new DefaultPointcutAdvisor(pointcut, advice); }
From source file:net.bull.javamelody.JavaMelodyAutoConfiguration.java
/** * Monitoring of beans methods having the {@link Scheduled} or {@link Schedules} annotations. * @return MonitoringSpringAdvisor/*from w ww. j a v a 2 s. co m*/ */ @Bean @ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true) public MonitoringSpringAdvisor monitoringSpringScheduledAdvisor() { return new MonitoringSpringAdvisor(Pointcuts.union(new AnnotationMatchingPointcut(null, Scheduled.class), new AnnotationMatchingPointcut(null, Schedules.class))); }
From source file:org.lexevs.dao.database.service.error.ErrorCallbackDatabaseServiceFactory.java
/** * Gets the error callback database service. * // w ww . ja v a 2 s. com * @param databaseService the database service * @param callback the callback * * @return the error callback database service */ @SuppressWarnings("unchecked") public <T> T getErrorCallbackDatabaseService(T databaseService, ErrorCallbackListener callback) { ErrorHandlingService serviceAnnotation = AnnotationUtils.findAnnotation(databaseService.getClass(), ErrorHandlingService.class); if (serviceAnnotation == null) { throw new RuntimeException( "Class: " + databaseService.getClass().getName() + " is not an Error Handling Service."); } ProxyFactory pf = new ProxyFactory(databaseService); pf.setProxyTargetClass(true); ErrorCallbackInterceptor interceptor = new ErrorCallbackInterceptor(callback); if (serviceAnnotation.matchAllMethods()) { pf.addAdvice(interceptor); } else { AnnotationMatchingPointcut pointcut = new AnnotationMatchingPointcut(null, DatabaseErrorIdentifier.class); Advisor advisor = new DefaultPointcutAdvisor(pointcut, interceptor); pf.addAdvisor(advisor); Class<?>[] annotationClasses = serviceAnnotation.matchAnnotatedMethods(); if (!ArrayUtils.isEmpty(annotationClasses)) { for (Class clazz : annotationClasses) { AnnotationMatchingPointcut methodAnnotationPointcuts = new AnnotationMatchingPointcut( ErrorHandlingService.class, clazz); pf.addAdvisor(new DefaultPointcutAdvisor(methodAnnotationPointcuts, interceptor)); } } } Object obj = pf.getProxy(); return (T) obj; }