Java Code Examples for org.springframework.aop.support.DelegatePerTargetObjectIntroductionInterceptor

Following code examples demonstrate how to use org.springframework.aop.support.DelegatePerTargetObjectIntroductionInterceptorfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.aop.support.DelegatePerTargetObjectIntroductionInterceptorand various code implementation of this class.

    public static void main(String[] args) {


        DelegatePerTargetObjectIntroductionInterceptor interceptor = new DelegatePerTargetObjectIntroductionInterceptor(Tester.class, ITester.class);

        ProxyFactory weaver  = new ProxyFactory();
        weaver.setTarget(new Developer());
        weaver.addAdvice(interceptor);

        Object proxyObject = weaver.getProxy();
        System.out.println("---" + proxyObject);
        ((ITester) proxyObject).testSoftware();

    } 


        public final AbstractBeanFactoryAwareAdvisingPostProcessor abstractBeanFactoryAwareAdvisingPostProcessor(DelegatePerTargetObjectIntroductionInterceptor delegatePerTargetObjectIntroductionInterceptor) {
            return new AbstractBeanFactoryAwareAdvisingPostProcessor() {
                @Override
                protected void evaluateProxyInterfaces(Class<?> beanClass, ProxyFactory proxyFactory) {
                    super.evaluateProxyInterfaces(beanClass, proxyFactory);
                }
            };
        } 

Advertisement
Javadoc
Convenient implementation of the org.springframework.aop.IntroductionInterceptor interface.
<

br>This differs from DelegatingIntroductionInterceptor in that a single instance of this class can be used to advise multiple target objects, and each target object will have its own delegate (whereas DelegatingIntroductionInterceptor shares the same delegate, and hence the same state across all targets).

The suppressInterface method can be used to suppress interfaces implemented by the delegate class but which should not be introduced to the owning AOP proxy.

An instance of this class is serializable if the delegates are.

Note: There are some implementation similarities between this class and DelegatingIntroductionInterceptor that suggest a possible refactoring to extract a common ancestor class in the future. @author Adrian Colyer @author Juergen Hoeller @since 2.0 @see #suppressInterface @see DelegatingIntroductionInterceptor

Read More
Advertisement