Examples of TargetSource


Examples of org.springframework.aop.TargetSource

    // We can't create fancy target sources for directly registered singletons.
    if (this.customTargetSourceCreators != null &&
        this.beanFactory != null && this.beanFactory.containsBean(beanName)) {
      for (int i = 0; i < this.customTargetSourceCreators.length; i++) {
        TargetSourceCreator tsc = this.customTargetSourceCreators[i];
        TargetSource ts = tsc.getTargetSource(beanClass, beanName);
        if (ts != null) {
          // Found a matching TargetSource.
          if (logger.isDebugEnabled()) {
            logger.debug("TargetSourceCreator [" + tsc +
                " found custom TargetSource for bean with name '" + beanName + "'");
View Full Code Here

Examples of org.springframework.aop.TargetSource

     * be returned from this method.
     */
    public static Object getRealBean(Object proxy) throws Exception
    {
        Advised advised = (Advised) proxy;
        TargetSource targetSource = advised.getTargetSource();
        Object real = targetSource.getTarget();
       
        // Possibly we could add a method on the ScopedBeanTargetSource class to test
        // whether the target bean exists. Then here we could cast TargetSource to
        // ScopedBeanTargetSource and return null if the target does not exist. This
        // might be useful, but let's leave that until someone actually has a use-case
View Full Code Here

Examples of org.springframework.aop.TargetSource

    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    public ExecutorTemplate get() {
        TargetSource targetSource = (TargetSource) this.beanFactory.getBean("executorTemplateTargetSource");
        try {
            return (ExecutorTemplate) targetSource.getTarget();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.springframework.aop.TargetSource

            throw new RuntimeException(e);
        }
    }

    public void release(ExecutorTemplate target) {
        TargetSource targetSource = (TargetSource) this.beanFactory.getBean("executorTemplateTargetSource");
        try {
            targetSource.releaseTarget(target);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of org.springframework.aop.TargetSource

    protected Class<?> getRealClassInternal(Object o) {
        if (AopUtils.isAopProxy(o) && (o instanceof Advised)) {
            Advised advised = (Advised)o;
            try {
                TargetSource targetSource = advised.getTargetSource();
               
                Object target = null;
               
                try {
                    target = targetSource.getTarget();
                } catch (BeanCreationException ex) {
                    // some scopes such as 'request' may not
                    // be active on the current thread yet
                    return getRealClassFromClassInternal(targetSource.getTargetClass());
                }
               
                if (target == null) {
                    Class<?> targetClass = AopUtils.getTargetClass(o);
                    if (targetClass != null) {
View Full Code Here

Examples of org.springframework.aop.TargetSource

        Project basicProjectTargetReturned = basicProjectProxyUtil
                .getTarget(basicProject);

        // Project est un proxy, il faut récupérer la target
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();
        Object target = ((SingletonTargetSource) targetSource).getTarget();

        assertEquals(basicProjectTargetReturned, target);

    }
View Full Code Here

Examples of org.springframework.aop.TargetSource

    public Project getTarget(Project project) {

        if (project instanceof Advised) {

            // Project est un proxy, il faut récupérer la target
            TargetSource targetSource = ((Advised) project)
                    .getTargetSource();
            Object target = ((SingletonTargetSource) targetSource).getTarget();

            // retour de la target
            return (Project) target;
View Full Code Here

Examples of org.springframework.aop.TargetSource

       
        // Test le retour de la liste
        assertEquals(set, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set, basicProjectTarget.getMembers());
View Full Code Here

Examples of org.springframework.aop.TargetSource

        // Test le retour de la liste
        assertEquals(set2, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set2, basicProjectTarget.getMembers());
View Full Code Here

Examples of org.springframework.aop.TargetSource

        // Test sur la retour de la liste
        assertEquals(set2, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set2, basicProjectTarget.getMembers());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.