org.springframework.aop.aspectj.AspectJExpressionPointcut Java Examples
The following examples show how to use
org.springframework.aop.aspectj.AspectJExpressionPointcut.
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: ReflectiveAspectJAdvisorFactory.java From spring-analysis-note with MIT License | 6 votes |
@Nullable private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { // 注释 8.5 获取方法上的注解 AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } // 使用 AspectJExpressionPointCut 实例封装获取的信息 AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); if (this.beanFactory != null) { ajexp.setBeanFactory(this.beanFactory); } return ajexp; }
Example #2
Source File: ReflectiveAspectJAdvisorFactory.java From java-technology-stack with MIT License | 6 votes |
@Override @Nullable public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName) { validate(aspectInstanceFactory.getAspectMetadata().getAspectClass()); AspectJExpressionPointcut expressionPointcut = getPointcut( candidateAdviceMethod, aspectInstanceFactory.getAspectMetadata().getAspectClass()); if (expressionPointcut == null) { return null; } return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod, this, aspectInstanceFactory, declarationOrderInAspect, aspectName); }
Example #3
Source File: ReflectiveAspectJAdvisorFactory.java From java-technology-stack with MIT License | 6 votes |
@Nullable private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); if (this.beanFactory != null) { ajexp.setBeanFactory(this.beanFactory); } return ajexp; }
Example #4
Source File: AspectJPointcutAdvisorTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testPerTarget() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl( ajexp, TestBean.class.getMethod("getAge"), af, new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(), "someBean"), 1, "someBean"); assertNotSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut); assertTrue(ajpa.isPerInstance()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)); assertFalse(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getAge"), TestBean.class)); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getSpouse"), TestBean.class)); }
Example #5
Source File: AspectJPointcutAdvisorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testPerTarget() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(),"someBean"), null, 1, "someBean"); assertNotSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut); assertTrue(ajpa.isPerInstance()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)); assertFalse(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getAge", (Class[]) null), TestBean.class)); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getSpouse", (Class[]) null), TestBean.class)); }
Example #6
Source File: HttpRequestParamsValidateManager.java From common-project with Apache License 2.0 | 6 votes |
/** * 设置注册bean动态AOP信息 * * @param configs * @param beanFactory */ private void setAopInfo(List<String> configs, ConfigurableListableBeanFactory beanFactory) { if (beanFactory instanceof BeanDefinitionRegistry) { BeanDefinitionRegistry beanDefinitionRegistry = (BeanDefinitionRegistry) beanFactory; for (String config : configs) { //增强器 RootBeanDefinition advisor = new RootBeanDefinition(DefaultBeanFactoryPointcutAdvisor.class); advisor.getPropertyValues().addPropertyValue("adviceBeanName", new RuntimeBeanReference("httpParamsValidateAdvisor").getBeanName()); //切点类 RootBeanDefinition pointCut = new RootBeanDefinition(AspectJExpressionPointcut.class); pointCut.setScope(BeanDefinition.SCOPE_PROTOTYPE); pointCut.setSynthetic(true); pointCut.getPropertyValues().addPropertyValue("expression", config); advisor.getPropertyValues().addPropertyValue("pointcut", pointCut); //注册到spring容器 String beanName = BeanDefinitionReaderUtils.generateBeanName(advisor, beanDefinitionRegistry, false); beanDefinitionRegistry.registerBeanDefinition(beanName, advisor); } } }
Example #7
Source File: AspectJPointcutAdvisorTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testPerTarget() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl( ajexp, TestBean.class.getMethod("getAge"), af, new SingletonMetadataAwareAspectInstanceFactory(new PerTargetAspect(), "someBean"), 1, "someBean"); assertNotSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut() instanceof AspectJExpressionPointcut); assertTrue(ajpa.isPerInstance()); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getClassFilter().matches(TestBean.class)); assertFalse(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getAge"), TestBean.class)); assertTrue(ajpa.getAspectMetadata().getPerClausePointcut().getMethodMatcher().matches( TestBean.class.getMethod("getSpouse"), TestBean.class)); }
Example #8
Source File: ReflectiveAspectJAdvisorFactory.java From spring-analysis-note with MIT License | 6 votes |
@Override @Nullable public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName) { validate(aspectInstanceFactory.getAspectMetadata().getAspectClass()); // 切点信息的获取 AspectJExpressionPointcut expressionPointcut = getPointcut( candidateAdviceMethod, aspectInstanceFactory.getAspectMetadata().getAspectClass()); if (expressionPointcut == null) { return null; } // 注释 8.8 根据切点信息生成增强器 return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod, this, aspectInstanceFactory, declarationOrderInAspect, aspectName); }
Example #9
Source File: ReflectiveAspectJAdvisorFactory.java From spring4-understanding with Apache License 2.0 | 5 votes |
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); return ajexp; }
Example #10
Source File: InstantiationModelAwarePointcutAdvisorImpl.java From spring4-understanding with Apache License 2.0 | 5 votes |
public InstantiationModelAwarePointcutAdvisorImpl(AspectJAdvisorFactory af, AspectJExpressionPointcut ajexp, MetadataAwareAspectInstanceFactory aif, Method method, int declarationOrderInAspect, String aspectName) { this.declaredPointcut = ajexp; this.method = method; this.atAspectJAdvisorFactory = af; this.aspectInstanceFactory = aif; this.declarationOrder = declarationOrderInAspect; this.aspectName = aspectName; if (aif.getAspectMetadata().isLazilyInstantiated()) { // Static part of the pointcut is a lazy type. Pointcut preInstantiationPointcut = Pointcuts.union(aif.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut); // Make it dynamic: must mutate from pre-instantiation to post-instantiation state. // If it's not a dynamic pointcut, it may be optimized out // by the Spring AOP infrastructure after the first evaluation. this.pointcut = new PerTargetInstantiationModelPointcut(this.declaredPointcut, preInstantiationPointcut, aif); this.lazy = true; } else { // A singleton aspect. this.instantiatedAdvice = instantiateAdvice(this.declaredPointcut); this.pointcut = declaredPointcut; this.lazy = false; } }
Example #11
Source File: ConfigBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Creates a {@link BeanDefinition} for the {@link AspectJExpressionPointcut} class using * the supplied pointcut expression. */ protected AbstractBeanDefinition createPointcutDefinition(String expression) { RootBeanDefinition beanDefinition = new RootBeanDefinition(AspectJExpressionPointcut.class); beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE); beanDefinition.setSynthetic(true); beanDefinition.getPropertyValues().add(EXPRESSION, expression); return beanDefinition; }
Example #12
Source File: GroovyAspectTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void manualGroovyBeanWithDynamicPointcutProxyTargetClass() throws Exception { TestService target = (TestService) scriptFactory.getScriptedObject(new ResourceScriptSource( new ClassPathResource("GroovyServiceImpl.grv", getClass()))); AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(String.format("@within(%s.Log)", ClassUtils.getPackageName(getClass()))); testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, target, "GroovyServiceImpl", true); }
Example #13
Source File: AbstractAspectJAdvisorFactory.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * The pointcut and advice annotations both have an "argNames" member which contains a * comma-separated list of the argument names. We use this (if non-empty) to build the * formal parameters for the pointcut. */ protected AspectJExpressionPointcut createPointcutExpression( Method annotatedMethod, Class<?> declarationScope, String[] pointcutParameterNames) { Class<?> [] pointcutParameterTypes = new Class<?>[0]; if (pointcutParameterNames != null) { pointcutParameterTypes = extractPointcutParameterTypes(pointcutParameterNames,annotatedMethod); } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(declarationScope,pointcutParameterNames,pointcutParameterTypes); ajexp.setLocation(annotatedMethod.toString()); return ajexp; }
Example #14
Source File: InstantiationModelAwarePointcutAdvisorImpl.java From spring4-understanding with Apache License 2.0 | 5 votes |
private PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPointcut, Pointcut preInstantiationPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory) { this.declaredPointcut = declaredPointcut; this.preInstantiationPointcut = preInstantiationPointcut; if (aspectInstanceFactory instanceof LazySingletonAspectInstanceFactoryDecorator) { this.aspectInstanceFactory = (LazySingletonAspectInstanceFactoryDecorator) aspectInstanceFactory; } }
Example #15
Source File: GroovyAspectTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void manualGroovyBeanWithStaticPointcut() throws Exception { TestService target = (TestService) scriptFactory.getScriptedObject(new ResourceScriptSource( new ClassPathResource("GroovyServiceImpl.grv", getClass()))); AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(String.format("execution(* %s.TestService+.*(..))", ClassUtils.getPackageName(getClass()))); testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, target, "GroovyServiceImpl", true); }
Example #16
Source File: GroovyAspectTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void manualGroovyBeanWithDynamicPointcut() throws Exception { TestService target = (TestService) scriptFactory.getScriptedObject(new ResourceScriptSource( new ClassPathResource("GroovyServiceImpl.grv", getClass()))); AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(String.format("@within(%s.Log)", ClassUtils.getPackageName(getClass()))); testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, target, "GroovyServiceImpl", false); }
Example #17
Source File: GroovyAspectTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void manualGroovyBeanWithDynamicPointcutProxyTargetClass() throws Exception { TestService target = (TestService) scriptFactory.getScriptedObject(new ResourceScriptSource( new ClassPathResource("GroovyServiceImpl.grv", getClass()))); AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(String.format("@within(%s.Log)", ClassUtils.getPackageName(getClass()))); testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, target, "GroovyServiceImpl", true); }
Example #18
Source File: AspectJPointcutAdvisorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testSingleton() throws SecurityException, NoSuchMethodException { AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(); ajexp.setExpression(AspectJExpressionPointcutTests.MATCH_ALL_METHODS); InstantiationModelAwarePointcutAdvisorImpl ajpa = new InstantiationModelAwarePointcutAdvisorImpl(af, ajexp, new SingletonMetadataAwareAspectInstanceFactory(new AbstractAspectJAdvisorFactoryTests.ExceptionAspect(null),"someBean"), TestBean.class.getMethod("getAge", (Class[]) null),1,"someBean"); assertSame(Pointcut.TRUE, ajpa.getAspectMetadata().getPerClausePointcut()); assertFalse(ajpa.isPerInstance()); }
Example #19
Source File: ProgrammaticTransactionConfig.java From spring-boot-cookbook with Apache License 2.0 | 5 votes |
/** * 切面拦截规则 */ @Bean public Advisor txAdviceAdvisor() { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(AOP_POINTCUT_EXPRESSION); return new DefaultPointcutAdvisor(pointcut, this.defaultTransactionInterceptor(this.transactionManager, null)); }
Example #20
Source File: MulCommonBaseServiceParser.java From zxl with Apache License 2.0 | 5 votes |
private void buildPointcutAndAdvisorBeanDefinition(String name, List<String> expressionList, ParserContext parserContext, BeanDefinitionRegistry beanDefinitionRegistry) { CompositeComponentDefinition compositeComponentDefinition = new CompositeComponentDefinition("mul-transaction-expression", null); parserContext.pushContainingComponent(compositeComponentDefinition); BeanDefinition aspectJAutoProxyCreatorBeanDefinition = AopConfigUtils.registerAspectJAutoProxyCreatorIfNecessary(beanDefinitionRegistry); AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(beanDefinitionRegistry); if (aspectJAutoProxyCreatorBeanDefinition != null) { BeanComponentDefinition componentDefinition = new BeanComponentDefinition(aspectJAutoProxyCreatorBeanDefinition, AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME); parserContext.registerComponent(componentDefinition); } for (String expression : expressionList) { RootBeanDefinition pointcutDefinition = new RootBeanDefinition(AspectJExpressionPointcut.class); pointcutDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE); pointcutDefinition.setSynthetic(true); pointcutDefinition.getPropertyValues().add("expression", expression); String pointcutBeanName = parserContext.getReaderContext().registerWithGeneratedName(pointcutDefinition); parserContext.registerComponent(new PointcutComponentDefinition(pointcutBeanName, pointcutDefinition, expression)); RootBeanDefinition advisorDefinition = new RootBeanDefinition(DefaultBeanFactoryPointcutAdvisor.class); advisorDefinition.getPropertyValues().add("adviceBeanName", new RuntimeBeanNameReference(name + HIBERNATE_ADVICE_SUFFIX)); String advisorBeanName = parserContext.getReaderContext().registerWithGeneratedName(advisorDefinition); advisorDefinition.getPropertyValues().add("pointcut", new RuntimeBeanReference(pointcutBeanName)); parserContext.registerComponent(new AdvisorComponentDefinition(advisorBeanName, advisorDefinition)); } parserContext.popAndRegisterContainingComponent(); }
Example #21
Source File: AspectJPrecedenceComparatorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { this.comparator = new AspectJPrecedenceComparator(); this.anyOldMethod = getClass().getMethods()[0]; this.anyOldPointcut = new AspectJExpressionPointcut(); this.anyOldPointcut.setExpression("execution(* *(..))"); }
Example #22
Source File: ReflectiveAspectJAdvisorFactory.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aif, int declarationOrderInAspect, String aspectName) { validate(aif.getAspectMetadata().getAspectClass()); AspectJExpressionPointcut ajexp = getPointcut(candidateAdviceMethod, aif.getAspectMetadata().getAspectClass()); if (ajexp == null) { return null; } return new InstantiationModelAwarePointcutAdvisorImpl( this, ajexp, aif, candidateAdviceMethod, declarationOrderInAspect, aspectName); }
Example #23
Source File: ConfigBeanDefinitionParser.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Creates a {@link BeanDefinition} for the {@link AspectJExpressionPointcut} class using * the supplied pointcut expression. */ protected AbstractBeanDefinition createPointcutDefinition(String expression) { RootBeanDefinition beanDefinition = new RootBeanDefinition(AspectJExpressionPointcut.class); beanDefinition.setScope(BeanDefinition.SCOPE_PROTOTYPE); beanDefinition.setSynthetic(true); beanDefinition.getPropertyValues().add(EXPRESSION, expression); return beanDefinition; }
Example #24
Source File: InstantiationModelAwarePointcutAdvisorImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPointcut, Pointcut preInstantiationPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory) { this.declaredPointcut = declaredPointcut; this.preInstantiationPointcut = preInstantiationPointcut; if (aspectInstanceFactory instanceof LazySingletonAspectInstanceFactoryDecorator) { this.aspectInstanceFactory = (LazySingletonAspectInstanceFactoryDecorator) aspectInstanceFactory; } }
Example #25
Source File: InstantiationModelAwarePointcutAdvisorImpl.java From lams with GNU General Public License v2.0 | 5 votes |
public InstantiationModelAwarePointcutAdvisorImpl(AspectJExpressionPointcut declaredPointcut, Method aspectJAdviceMethod, AspectJAdvisorFactory aspectJAdvisorFactory, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName) { this.declaredPointcut = declaredPointcut; this.declaringClass = aspectJAdviceMethod.getDeclaringClass(); this.methodName = aspectJAdviceMethod.getName(); this.parameterTypes = aspectJAdviceMethod.getParameterTypes(); this.aspectJAdviceMethod = aspectJAdviceMethod; this.aspectJAdvisorFactory = aspectJAdvisorFactory; this.aspectInstanceFactory = aspectInstanceFactory; this.declarationOrder = declarationOrder; this.aspectName = aspectName; if (aspectInstanceFactory.getAspectMetadata().isLazilyInstantiated()) { // Static part of the pointcut is a lazy type. Pointcut preInstantiationPointcut = Pointcuts.union( aspectInstanceFactory.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut); // Make it dynamic: must mutate from pre-instantiation to post-instantiation state. // If it's not a dynamic pointcut, it may be optimized out // by the Spring AOP infrastructure after the first evaluation. this.pointcut = new PerTargetInstantiationModelPointcut( this.declaredPointcut, preInstantiationPointcut, aspectInstanceFactory); this.lazy = true; } else { // A singleton aspect. this.pointcut = this.declaredPointcut; this.lazy = false; this.instantiatedAdvice = instantiateAdvice(this.declaredPointcut); } }
Example #26
Source File: ReflectiveAspectJAdvisorFactory.java From lams with GNU General Public License v2.0 | 5 votes |
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) { AspectJAnnotation<?> aspectJAnnotation = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod); if (aspectJAnnotation == null) { return null; } AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut(candidateAspectClass, new String[0], new Class<?>[0]); ajexp.setExpression(aspectJAnnotation.getPointcutExpression()); ajexp.setBeanFactory(this.beanFactory); return ajexp; }
Example #27
Source File: ReflectiveAspectJAdvisorFactory.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName) { validate(aspectInstanceFactory.getAspectMetadata().getAspectClass()); AspectJExpressionPointcut expressionPointcut = getPointcut( candidateAdviceMethod, aspectInstanceFactory.getAspectMetadata().getAspectClass()); if (expressionPointcut == null) { return null; } return new InstantiationModelAwarePointcutAdvisorImpl(expressionPointcut, candidateAdviceMethod, this, aspectInstanceFactory, declarationOrderInAspect, aspectName); }
Example #28
Source File: CustomPerformanceMonitorAdvisor.java From Hands-On-High-Performance-with-Spring-5 with MIT License | 5 votes |
public CustomPerformanceMonitorAdvisor(CustomPerformanceMonitorInterceptor performanceMonitorInterceptor) { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression( "com.packt.springhighperformance.ch03.bankingapp.aspect.TransferMonitoringAspect.transfer()"); this.setPointcut(pointcut); this.setAdvice(performanceMonitorInterceptor); }
Example #29
Source File: PerformanceMonitorAdvisor.java From Hands-On-High-Performance-with-Spring-5 with MIT License | 5 votes |
public PerformanceMonitorAdvisor(PerformanceMonitorInterceptor performanceMonitorInterceptor) { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression( "com.packt.springhighperformance.ch03.bankingapp.aspect.TransferMonitoringAspect.transfer()"); this.setPointcut(pointcut); this.setAdvice(performanceMonitorInterceptor); }
Example #30
Source File: LoggingConfiguration.java From spring-data-simpledb with MIT License | 5 votes |
@Bean public Advisor traceAdvisor() { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(POINTCUT_EXECUTION_REPOSITORY); return new DefaultPointcutAdvisor(pointcut, interceptor()); }