Java Code Examples for org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor

The following examples show how to use org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor. These examples are extracted from open source projects. 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 Project: Milkomeda   Source File: DelegatingBeanDefinitionRegistrar.java    License: 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 Project: AnyMock   Source File: DigestLoggerConfig.java    License: 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 Project: super-cloudops   Source File: CounterMetricsAdvice.java    License: 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 Project: super-cloudops   Source File: TimerMetricsAdvice.java    License: 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 Project: super-cloudops   Source File: XssAutoConfiguration.java    License: 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 Project: justtestlah   Source File: AopConfig.java    License: 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 Project: justtestlah   Source File: AopConfig.java    License: 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;
}