本文整理汇总了Java中org.springframework.aop.support.annotation.AnnotationMatchingPointcut类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationMatchingPointcut类的具体用法?Java AnnotationMatchingPointcut怎么用?Java AnnotationMatchingPointcut使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationMatchingPointcut类属于org.springframework.aop.support.annotation包,在下文中一共展示了AnnotationMatchingPointcut类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPointcut
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
/**
* Calculate a pointcut for the given async annotation types, if any.
* @param asyncAnnotationTypes the async annotation types to introspect
* @return the applicable Pointcut object, or {@code null} if none
*/
protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) {
ComposablePointcut result = null;
for (Class<? extends Annotation> asyncAnnotationType : asyncAnnotationTypes) {
Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(asyncAnnotationType);
if (result == null) {
result = new ComposablePointcut(cpc).union(mpc);
}
else {
result.union(cpc).union(mpc);
}
}
return result;
}
示例2: afterPropertiesSet
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
Pointcut pointcut = new AnnotationMatchingPointcut(this.validatedAnnotationType, true);
Advice advice = (this.validator != null ? new MethodValidationInterceptor(this.validator) :
new MethodValidationInterceptor());
this.advisor = new DefaultPointcutAdvisor(pointcut, advice);
}
示例3: PersistenceExceptionTranslationAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
/**
* Create a new PersistenceExceptionTranslationAdvisor.
* @param persistenceExceptionTranslator the PersistenceExceptionTranslator to use
* @param repositoryAnnotationType the annotation type to check for
*/
public PersistenceExceptionTranslationAdvisor(
PersistenceExceptionTranslator persistenceExceptionTranslator,
Class<? extends Annotation> repositoryAnnotationType) {
this.advice = new PersistenceExceptionTranslationInterceptor(persistenceExceptionTranslator);
this.pointcut = new AnnotationMatchingPointcut(repositoryAnnotationType, true);
}
示例4: init
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@PostConstruct
public void init() {
logger.info("init LogAutoConfiguration start");
this.pointcut = new AnnotationMatchingPointcut(null, Log.class);
this.advice = new LogMethodInterceptor(logProperties.getExcludeArr());
logger.info("init LogAutoConfiguration end");
}
示例5: springServiceMonitoringAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@ConditionalOnProperty(name = "javamelody.enableSpringServiceMonitoring", havingValue = "true")
@Bean
public MonitoringSpringAdvisor springServiceMonitoringAdvisor() {
final MonitoringSpringAdvisor interceptor = new MonitoringSpringAdvisor();
interceptor.setPointcut(new AnnotationMatchingPointcut(Service.class));
return interceptor;
}
示例6: springControllerMonitoringAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@ConditionalOnProperty(name = "javamelody.enableSpringControllerMonitoring", havingValue = "true")
@Bean
public MonitoringSpringAdvisor springControllerMonitoringAdvisor() {
final MonitoringSpringAdvisor interceptor = new MonitoringSpringAdvisor();
interceptor.setPointcut(new AnnotationMatchingPointcut(Controller.class));
return interceptor;
}
示例7: monitoringSpringAsyncAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
/**
* Monitoring of beans or methods having the {@link Async} annotation.
* @return MonitoringSpringAdvisor
*/
@Bean
@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true)
public MonitoringSpringAdvisor monitoringSpringAsyncAdvisor() {
return new MonitoringSpringAdvisor(
Pointcuts.union(new AnnotationMatchingPointcut(Async.class),
new AnnotationMatchingPointcut(null, Async.class)));
}
示例8: monitoringSpringScheduledAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
/**
* Monitoring of beans methods having the {@link Scheduled} or {@link Schedules} annotations,
* only if <code>scheduled-monitoring-enabled: true</code> is added in application.yml.
* @return MonitoringSpringAdvisor
*/
@Bean
@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "scheduled-monitoring-enabled", matchIfMissing = false)
public MonitoringSpringAdvisor monitoringSpringScheduledAdvisor() {
// only if scheduled-monitoring-enabled because of #643,
// but https://jira.spring.io/browse/SPR-15562 may change that
return new MonitoringSpringAdvisor(
Pointcuts.union(new AnnotationMatchingPointcut(null, Scheduled.class),
new AnnotationMatchingPointcut(null, Schedules.class)));
}
示例9: afterPropertiesSet
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
// see MethodValidationPostProcessor
Pointcut pointcut = new AnnotationMatchingPointcut(null, UnitOfWork.class);
this.advisor = new DefaultPointcutAdvisor(pointcut, interceptor);
}
示例10: afterPropertiesSet
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
Pointcut pointcut = new AnnotationMatchingPointcut(this.validatedAnnotationType, true);
this.advisor = new DefaultPointcutAdvisor(pointcut, createMethodValidationAdvice(this.validator));
}
示例11: springServiceMonitoringAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Bean
public MonitoringSpringAdvisor springServiceMonitoringAdvisor() {
final MonitoringSpringAdvisor interceptor = new MonitoringSpringAdvisor();
interceptor.setPointcut(new AnnotationMatchingPointcut(Service.class));
return interceptor;
}
示例12: springControllerMonitoringAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Bean
public MonitoringSpringAdvisor springControllerMonitoringAdvisor() {
final MonitoringSpringAdvisor interceptor = new MonitoringSpringAdvisor();
interceptor.setPointcut(new AnnotationMatchingPointcut(Controller.class));
return interceptor;
}
示例13: springRestControllerMonitoringAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
@Bean
public MonitoringSpringAdvisor springRestControllerMonitoringAdvisor() {
final MonitoringSpringAdvisor interceptor = new MonitoringSpringAdvisor();
interceptor.setPointcut(new AnnotationMatchingPointcut(RestController.class));
return interceptor;
}
示例14: intercept
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
public static <T> T intercept(Object target, Class<? extends Annotation> annoClass, MethodInterceptor methodInterceptor){
return intercept(target, ()->AnnotationMatchingPointcut.forMethodAnnotation(annoClass), methodInterceptor);
}
示例15: monitoringSpringServiceAdvisor
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut; //导入依赖的package包/类
/**
* Monitoring of beans having the {@link Service} annotation.
* @return MonitoringSpringAdvisor
*/
@Bean
@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "spring-monitoring-enabled", matchIfMissing = true)
public MonitoringSpringAdvisor monitoringSpringServiceAdvisor() {
return new MonitoringSpringAdvisor(new AnnotationMatchingPointcut(Service.class));
}