org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor Java Examples

The following examples show how to use org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DelegatingBeanDefinitionRegistrar.java    From Milkomeda with MIT License 6 votes vote down vote up
@Override
public void registerBeanDefinitions(@NonNull AnnotationMetadata importingClassMetadata,
                                    @NonNull BeanDefinitionRegistry registry) {
    SundialProperties props = binder.bind("milkomeda.sundial", SundialProperties.class).get();
    List<SundialProperties.Strategy> strategyList = props.getStrategy();
    if (CollectionUtils.isEmpty(strategyList)) {
        return;
    }
    for (SundialProperties.Strategy strategy : strategyList) {
        String beanName = "mk_sundial_advisor_" + strategy.getKeyName();
        Advice advice = new DelegatingDataSourceAdvice(strategy.getKeyName());
        BeanDefinition aspectJBean = BeanDefinitionBuilder.genericBeanDefinition(AspectJExpressionPointcutAdvisor.class)
                .addPropertyValue("location", "$$aspectJAdvisor##")
                .addPropertyValue("expression", strategy.getPointcutExpression())
                .addPropertyValue("advice", advice)
                .getBeanDefinition();
        registry.registerBeanDefinition(beanName, aspectJBean);
    }
}
 
Example #2
Source File: DigestLoggerConfig.java    From AnyMock with Apache License 2.0 5 votes vote down vote up
@Bean
public Advisor digestLogger() {
    AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
    advisor.setExpression("within(com.dxm.anymock.common.dal.dao..*)");
    advisor.setAdvice(new DigestLogger());
    return advisor;
}
 
Example #3
Source File: CounterMetricsAdvice.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Bean
public AspectJExpressionPointcutAdvisor counterAspectJExpressionPointcutAdvisor(CounterMetricsProperties conf,
		CounterMetricsAdvice advice) {
	Assert.notNull(conf.getExpression(), "Expression of the counter AOP pointcut is null.");
	if (log.isInfoEnabled()) {
		log.info("Initial counterAspectJExpressionPointcutAdvisor. {}", conf);
	}

	AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
	advisor.setExpression(conf.getExpression());
	advisor.setAdvice(advice);
	return advisor;
}
 
Example #4
Source File: TimerMetricsAdvice.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Bean
public AspectJExpressionPointcutAdvisor timerAspectJExpressionPointcutAdvisor(TimerMetricsProperties conf,
		TimerMetricsAdvice advice) {
	Assert.notNull(conf.getExpression(), "Expression of the timeouts AOP pointcut is null.");
	if (log.isInfoEnabled()) {
		log.info("Initial timerAspectJExpressionPointcutAdvisor. {}", conf);
	}

	AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
	advisor.setExpression(conf.getExpression());
	advisor.setAdvice(advice);
	return advisor;
}
 
Example #5
Source File: XssAutoConfiguration.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnBean(XssResolveAdviceInterceptor.class)
public AspectJExpressionPointcutAdvisor xssSecurityResolverAspectJExpressionPointcutAdvisor(XssProperties config,
		XssResolveAdviceInterceptor advice) {
	AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
	advisor.setExpression(config.getExpression());
	advisor.setAdvice(advice);
	return advisor;
}
 
Example #6
Source File: AopConfig.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
@Bean
public AspectJExpressionPointcutAdvisor stepsLoggingAdvisor() {
  AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
  advisor.setExpression(POINTCUT_TEMPLATE.replaceFirst("__package__", stepsPackage));
  advisor.setAdvice(entryExitLoggingAspect());
  return advisor;
}
 
Example #7
Source File: AopConfig.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
@Bean
public AspectJExpressionPointcutAdvisor pagesLoggingAdvisor() {
  AspectJExpressionPointcutAdvisor advisor = new AspectJExpressionPointcutAdvisor();
  advisor.setExpression(POINTCUT_TEMPLATE.replaceFirst("__package__", pagesPackage));
  advisor.setAdvice(entryExitLoggingAspect());
  return advisor;
}