Example usage for org.springframework.beans.factory.config BeanDefinition getBeanClassName

List of usage examples for org.springframework.beans.factory.config BeanDefinition getBeanClassName

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanDefinition getBeanClassName.

Prototype

@Nullable
String getBeanClassName();

Source Link

Document

Return the current bean class name of this bean definition.

Usage

From source file:org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.java

/**
 * Prepares Spring context.//  w  w  w  .  j  av  a  2 s  .c o  m
 *
 * @param excludedProps Properties to be excluded.
 * @return application context.
 */
private static GenericApplicationContext prepareSpringContext(final String... excludedProps) {
    GenericApplicationContext springCtx = new GenericApplicationContext();

    if (excludedProps.length > 0) {
        final List<String> excludedPropsList = Arrays.asList(excludedProps);

        BeanFactoryPostProcessor postProc = new BeanFactoryPostProcessor() {
            /**
             * @param def Registered BeanDefinition.
             * @throws BeansException in case of errors.
             */
            private void processNested(BeanDefinition def) throws BeansException {
                Iterator<PropertyValue> iterVals = def.getPropertyValues().getPropertyValueList().iterator();

                while (iterVals.hasNext()) {
                    PropertyValue val = iterVals.next();

                    if (excludedPropsList.contains(val.getName())) {
                        iterVals.remove();

                        continue;
                    }

                    if (val.getValue() instanceof Iterable) {
                        Iterator iterNested = ((Iterable) val.getValue()).iterator();

                        while (iterNested.hasNext()) {
                            Object item = iterNested.next();

                            if (item instanceof BeanDefinitionHolder) {
                                BeanDefinitionHolder h = (BeanDefinitionHolder) item;

                                try {
                                    if (h.getBeanDefinition().getBeanClassName() != null)
                                        Class.forName(h.getBeanDefinition().getBeanClassName());

                                    processNested(h.getBeanDefinition());
                                } catch (ClassNotFoundException ignored) {
                                    iterNested.remove();
                                }
                            }
                        }
                    }
                }
            }

            @Override
            public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
                    throws BeansException {
                for (String beanName : beanFactory.getBeanDefinitionNames()) {
                    try {
                        BeanDefinition def = beanFactory.getBeanDefinition(beanName);

                        if (def.getBeanClassName() != null)
                            Class.forName(def.getBeanClassName());

                        processNested(def);
                    } catch (ClassNotFoundException ignored) {
                        ((BeanDefinitionRegistry) beanFactory).removeBeanDefinition(beanName);
                    }
                }
            }
        };

        springCtx.addBeanFactoryPostProcessor(postProc);
    }

    return springCtx;
}

From source file:org.apache.syncope.client.console.init.ImplementationClassNamesLoader.java

@Override
@SuppressWarnings("unchecked")
public void load() {
    previewers = new ArrayList<>();
    extPanels = new ArrayList<>();

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
            false);/*from  w  ww .  jav a2 s .c  o m*/
    scanner.addIncludeFilter(new AssignableTypeFilter(AbstractBinaryPreviewer.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(AbstractExtensionPanel.class));

    for (BeanDefinition bd : scanner.findCandidateComponents(StringUtils.EMPTY)) {
        try {
            Class<?> clazz = ClassUtils.resolveClassName(bd.getBeanClassName(),
                    ClassUtils.getDefaultClassLoader());
            boolean isAbsractClazz = Modifier.isAbstract(clazz.getModifiers());

            if (AbstractBinaryPreviewer.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                previewers.add((Class<? extends AbstractBinaryPreviewer>) clazz);
            } else if (AbstractExtensionPanel.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                extPanels.add((Class<? extends AbstractExtensionPanel>) clazz);
            }

        } catch (Throwable t) {
            LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
        }
    }
    previewers = Collections.unmodifiableList(previewers);
    extPanels = Collections.unmodifiableList(extPanels);

    LOG.debug("Binary previewers found: {}", previewers);
    LOG.debug("Extension panels found: {}", extPanels);
}

From source file:org.apache.syncope.core.logic.init.ClassPathScanImplementationLookup.java

@Override
@SuppressWarnings("unchecked")
public void load() {
    classNames = new EnumMap<>(Type.class);
    for (Type type : Type.values()) {
        classNames.put(type, new HashSet<String>());
    }//from www .  ja v  a  2s  .c om

    reportletClasses = new HashMap<>();
    accountRuleClasses = new HashMap<>();
    passwordRuleClasses = new HashMap<>();

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
            false);
    scanner.addIncludeFilter(new AssignableTypeFilter(Reportlet.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(AccountRule.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PasswordRule.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(MappingItemTransformer.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(SchedTaskJobDelegate.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(ReconciliationFilterBuilder.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(LogicActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PropagationActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PullActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PushActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PullCorrelationRule.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(Validator.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(NotificationRecipientsProvider.class));

    for (BeanDefinition bd : scanner.findCandidateComponents(StringUtils.EMPTY)) {
        try {
            Class<?> clazz = ClassUtils.resolveClassName(bd.getBeanClassName(),
                    ClassUtils.getDefaultClassLoader());
            boolean isAbsractClazz = Modifier.isAbstract(clazz.getModifiers());

            if (Reportlet.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                ReportletConfClass annotation = clazz.getAnnotation(ReportletConfClass.class);
                if (annotation == null) {
                    LOG.warn("Found Reportlet {} without declared configuration", clazz.getName());
                } else {
                    classNames.get(Type.REPORTLET_CONF).add(annotation.value().getName());
                    reportletClasses.put(annotation.value(), (Class<? extends Reportlet>) clazz);
                }
            }

            if (AccountRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                AccountRuleConfClass annotation = clazz.getAnnotation(AccountRuleConfClass.class);
                if (annotation == null) {
                    LOG.warn("Found account policy rule {} without declared configuration", clazz.getName());
                } else {
                    classNames.get(Type.ACCOUNT_RULE_CONF).add(annotation.value().getName());
                    accountRuleClasses.put(annotation.value(), (Class<? extends AccountRule>) clazz);
                }
            }

            if (PasswordRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                PasswordRuleConfClass annotation = clazz.getAnnotation(PasswordRuleConfClass.class);
                if (annotation == null) {
                    LOG.warn("Found password policy rule {} without declared configuration", clazz.getName());
                } else {
                    classNames.get(Type.PASSWORD_RULE_CONF).add(annotation.value().getName());
                    passwordRuleClasses.put(annotation.value(), (Class<? extends PasswordRule>) clazz);
                }
            }

            if (MappingItemTransformer.class.isAssignableFrom(clazz) && !isAbsractClazz
                    && !clazz.equals(JEXLMappingItemTransformerImpl.class)) {

                classNames.get(Type.MAPPING_ITEM_TRANSFORMER).add(clazz.getName());
            }

            if (SchedTaskJobDelegate.class.isAssignableFrom(clazz) && !isAbsractClazz
                    && !PullJobDelegate.class.isAssignableFrom(clazz)
                    && !PushJobDelegate.class.isAssignableFrom(clazz)
                    && !GroupMemberProvisionTaskJobDelegate.class.isAssignableFrom(clazz)) {

                classNames.get(Type.TASKJOBDELEGATE).add(bd.getBeanClassName());
            }

            if (ReconciliationFilterBuilder.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.RECONCILIATION_FILTER_BUILDER).add(bd.getBeanClassName());
            }

            if (LogicActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.LOGIC_ACTIONS).add(bd.getBeanClassName());
            }

            if (PropagationActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.PROPAGATION_ACTIONS).add(bd.getBeanClassName());
            }

            if (PullActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.PULL_ACTIONS).add(bd.getBeanClassName());
            }

            if (PushActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.PUSH_ACTIONS).add(bd.getBeanClassName());
            }

            if (PullCorrelationRule.class.isAssignableFrom(clazz) && !isAbsractClazz
                    && !PlainAttrsPullCorrelationRule.class.isAssignableFrom(clazz)) {
                classNames.get(Type.PULL_CORRELATION_RULE).add(bd.getBeanClassName());
            }

            if (Validator.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.VALIDATOR).add(bd.getBeanClassName());
            }

            if (NotificationRecipientsProvider.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.NOTIFICATION_RECIPIENTS_PROVIDER).add(bd.getBeanClassName());
            }
        } catch (Throwable t) {
            LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
        }
    }
    classNames = Collections.unmodifiableMap(classNames);
    reportletClasses = Collections.unmodifiableMap(reportletClasses);
    accountRuleClasses = Collections.unmodifiableMap(accountRuleClasses);
    passwordRuleClasses = Collections.unmodifiableMap(passwordRuleClasses);

    LOG.debug("Implementation classes found: {}", classNames);
}

From source file:org.apache.syncope.core.logic.init.ImplementationClassNamesLoader.java

@Override
public void load() {
    classNames = new EnumMap<>(Type.class);
    for (Type type : Type.values()) {
        classNames.put(type, new HashSet<String>());
    }/* w  ww  .ja  v a2s .c o  m*/

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
            false);
    scanner.addIncludeFilter(new AssignableTypeFilter(Reportlet.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(TaskJob.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(SyncActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PushActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(SyncCorrelationRule.class));
    // Remove once SYNCOPE-631 is done
    //scanner.addIncludeFilter(new AssignableTypeFilter(PushCorrelationRule.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(PropagationActions.class));
    scanner.addIncludeFilter(new AssignableTypeFilter(Validator.class));

    for (BeanDefinition bd : scanner.findCandidateComponents(StringUtils.EMPTY)) {
        try {
            Class<?> clazz = ClassUtils.resolveClassName(bd.getBeanClassName(),
                    ClassUtils.getDefaultClassLoader());
            boolean isAbsractClazz = Modifier.isAbstract(clazz.getModifiers());

            if (Reportlet.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.REPORTLET).add(clazz.getName());
            }

            if (TaskJob.class.isAssignableFrom(clazz) && !isAbsractClazz
                    && !SyncJob.class.isAssignableFrom(clazz) && !PushJob.class.isAssignableFrom(clazz)) {

                classNames.get(Type.TASKJOB).add(bd.getBeanClassName());
            }

            if (SyncActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.SYNC_ACTIONS).add(bd.getBeanClassName());
            }

            if (PushActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.PUSH_ACTIONS).add(bd.getBeanClassName());
            }

            if (SyncCorrelationRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.SYNC_CORRELATION_RULE).add(bd.getBeanClassName());
            }

            // Uncomment when SYNCOPE-631 is done
            /* if (PushCorrelationRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
             * classNames.get(Type.PUSH_CORRELATION_RULES).add(metadata.getClassName());
             * } */
            if (PropagationActions.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.PROPAGATION_ACTIONS).add(bd.getBeanClassName());
            }

            if (Validator.class.isAssignableFrom(clazz) && !isAbsractClazz) {
                classNames.get(Type.VALIDATOR).add(bd.getBeanClassName());
            }
        } catch (Throwable t) {
            LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
        }
    }
    classNames = Collections.unmodifiableMap(classNames);

    LOG.debug("Implementation classes found: {}", classNames);
}

From source file:org.apache.usergrid.persistence.Schema.java

@SuppressWarnings("unchecked")
public void scanEntities() {
    synchronized (entitiesScanPath) {
        for (String path : entitiesScanPath) {
            ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
                    true);//from www  .ja  va 2s. co  m
            provider.addIncludeFilter(new AssignableTypeFilter(TypedEntity.class));

            Set<BeanDefinition> components = provider.findCandidateComponents(path);
            for (BeanDefinition component : components) {
                try {
                    Class<?> cls = Class.forName(component.getBeanClassName());
                    if (Entity.class.isAssignableFrom(cls)) {
                        registerEntity((Class<? extends Entity>) cls);
                    }
                } catch (ClassNotFoundException e) {
                    logger.error("Unable to get entity class ", e);
                }
            }
            registerEntity(DynamicEntity.class);
        }
    }
}

From source file:org.beangle.spring.bind.AutoConfigProcessor.java

protected Map<String, PropertyDescriptor> unsatisfiedNonSimpleProperties(BeanDefinition mbd) {
    Map<String, PropertyDescriptor> properties = CollectUtils.newHashMap();
    PropertyValues pvs = mbd.getPropertyValues();
    Class<?> clazz = null;// w  w  w . java2 s  . c o m
    try {
        clazz = Class.forName(mbd.getBeanClassName());
    } catch (ClassNotFoundException e) {
        logger.error("Class " + mbd.getBeanClassName() + "not found", e);
        return properties;
    }
    PropertyDescriptor[] pds = PropertyUtils.getPropertyDescriptors(clazz);
    for (PropertyDescriptor pd : pds) {
        if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName())
                && !BeanUtils.isSimpleProperty(pd.getPropertyType())) {
            properties.put(pd.getName(), pd);
        }
    }
    return properties;
}

From source file:org.beangle.spring.bind.DefinitionBindRegistry.java

public DefinitionBindRegistry(BeanDefinitionRegistry registry) {
    for (String name : registry.getBeanDefinitionNames()) {
        BeanDefinition bd = registry.getBeanDefinition(name);
        if (bd.isAbstract())
            continue;
        // find classname
        String className = bd.getBeanClassName();
        if (null == className) {
            String parentName = bd.getParentName();
            if (null == parentName)
                continue;
            else {
                BeanDefinition parentDef = registry.getBeanDefinition(parentName);
                className = parentDef.getBeanClassName();
            }/*from   w  w  w.  j  a  v  a 2s . c o  m*/
        }
        if (null == className)
            continue;

        try {
            Class<?> beanClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
            if (FactoryBean.class.isAssignableFrom(beanClass)) {
                register(beanClass, "&" + name);
                PropertyValue pv = bd.getPropertyValues().getPropertyValue("target");
                if (null == pv) {
                    Class<?> artifactClass = ((FactoryBean<?>) beanClass.newInstance()).getObjectType();
                    if (null != artifactClass)
                        register(artifactClass, name);
                } else {
                    if (pv.getValue() instanceof BeanDefinitionHolder) {
                        String nestedClassName = ((BeanDefinitionHolder) pv.getValue()).getBeanDefinition()
                                .getBeanClassName();
                        if (null != nestedClassName) {
                            register(ClassUtils.forName(nestedClassName, ClassUtils.getDefaultClassLoader()),
                                    name);
                        }
                    }
                }
            } else {
                register(beanClass, name);
            }
        } catch (Exception e) {
            logger.error("class not found", e);
            continue;
        }
    }
}

From source file:org.bytesoft.bytejta.supports.springcloud.SpringCloudConfiguration.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

    String[] beanNameArray = beanFactory.getBeanDefinitionNames();
    for (int i = 0; i < beanNameArray.length; i++) {
        BeanDefinition beanDef = beanFactory.getBeanDefinition(beanNameArray[i]);
        String beanClassName = beanDef.getBeanClassName();

        if (FEIGN_FACTORY_CLASS.equals(beanClassName) == false) {
            continue;
        }/*w w  w  . j av  a2 s  .c  o m*/

        MutablePropertyValues mpv = beanDef.getPropertyValues();
        PropertyValue pv = mpv.getPropertyValue("name");
        String client = String.valueOf(pv.getValue() == null ? "" : pv.getValue());
        if (StringUtils.isNotBlank(client)) {
            this.transientClientSet.add(client);
        }

    }

    this.fireAfterPropertiesSet();

}

From source file:org.bytesoft.bytetcc.supports.dubbo.CompensableConfigPostProcessor.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    String[] beanNameArray = beanFactory.getBeanDefinitionNames();

    String applicationBeanId = null;
    String registryBeanId = null;
    String transactionBeanId = null;
    String compensableBeanId = null;

    for (int i = 0; i < beanNameArray.length; i++) {
        String beanName = beanNameArray[i];
        BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
        String beanClassName = beanDef.getBeanClassName();
        if (com.alibaba.dubbo.config.ApplicationConfig.class.getName().equals(beanClassName)) {
            if (StringUtils.isBlank(applicationBeanId)) {
                applicationBeanId = beanName;
            } else {
                throw new FatalBeanException("There is more than one application name was found!");
            }/* w  w  w  .  ja v a 2  s.  com*/
        } else if (org.bytesoft.bytetcc.TransactionCoordinator.class.getName().equals(beanClassName)) {
            if (StringUtils.isBlank(transactionBeanId)) {
                transactionBeanId = beanName;
            } else {
                throw new FatalBeanException(
                        "There is more than one org.bytesoft.bytetcc.TransactionCoordinator was found!");
            }
        } else if (org.bytesoft.bytetcc.supports.dubbo.CompensableBeanRegistry.class.getName()
                .equals(beanClassName)) {
            if (StringUtils.isBlank(registryBeanId)) {
                registryBeanId = beanName;
            } else {
                throw new FatalBeanException(
                        "There is more than one org.bytesoft.bytetcc.supports.dubbo.CompensableBeanRegistry was found!");
            }
        } else if (org.bytesoft.bytetcc.CompensableCoordinator.class.getName().equals(beanClassName)) {
            if (StringUtils.isBlank(compensableBeanId)) {
                compensableBeanId = beanName;
            } else {
                throw new FatalBeanException(
                        "There is more than one org.bytesoft.bytetcc.CompensableCoordinator was found!");
            }
        }
    }

    if (StringUtils.isBlank(applicationBeanId)) {
        throw new FatalBeanException("No application name was found!");
    }

    BeanDefinition beanDef = beanFactory.getBeanDefinition(applicationBeanId);
    MutablePropertyValues mpv = beanDef.getPropertyValues();
    PropertyValue pv = mpv.getPropertyValue("name");

    if (pv == null || pv.getValue() == null || StringUtils.isBlank(String.valueOf(pv.getValue()))) {
        throw new FatalBeanException("No application name was found!");
    }

    if (StringUtils.isBlank(compensableBeanId)) {
        throw new FatalBeanException(
                "No configuration of class org.bytesoft.bytetcc.CompensableCoordinator was found.");
    } else if (StringUtils.isBlank(transactionBeanId)) {
        throw new FatalBeanException(
                "No configuration of class org.bytesoft.bytetcc.TransactionCoordinator was found.");
    } else if (registryBeanId == null) {
        throw new FatalBeanException(
                "No configuration of class org.bytesoft.bytetcc.supports.dubbo.CompensableBeanRegistry was found.");
    }

    String application = String.valueOf(pv.getValue());
    this.initializeForProvider(beanFactory, application, transactionBeanId);
    this.initializeForConsumer(beanFactory, application, registryBeanId);
}

From source file:org.bytesoft.bytetcc.supports.spring.CompensableAnnotationValidator.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    Map<String, Class<?>> otherServiceMap = new HashMap<String, Class<?>>();
    Map<String, Compensable> compensables = new HashMap<String, Compensable>();

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    String[] beanNameArray = beanFactory.getBeanDefinitionNames();
    for (int i = 0; beanNameArray != null && i < beanNameArray.length; i++) {
        String beanName = beanNameArray[i];
        BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
        String className = beanDef.getBeanClassName();
        Class<?> clazz = null;

        try {/*w w w. j  a v a 2 s .  c  o m*/
            clazz = cl.loadClass(className);
        } catch (ClassNotFoundException ex) {
            continue;
        }

        try {
            Compensable compensable = clazz.getAnnotation(Compensable.class);
            if (compensable == null) {
                otherServiceMap.put(beanName, clazz);
                continue;
            } else {
                compensables.put(beanName, compensable);
            }

            Class<?> interfaceClass = compensable.interfaceClass();
            if (interfaceClass.isInterface() == false) {
                throw new IllegalStateException("Compensable's interfaceClass must be a interface.");
            }
            Method[] methodArray = interfaceClass.getDeclaredMethods();
            for (int j = 0; j < methodArray.length; j++) {
                Method interfaceMethod = methodArray[j];
                Method method = clazz.getMethod(interfaceMethod.getName(), interfaceMethod.getParameterTypes());
                this.validateDeclaredRemotingException(method, clazz);
                this.validateTransactionalPropagation(method, clazz);
            }
        } catch (IllegalStateException ex) {
            throw new FatalBeanException(ex.getMessage(), ex);
        } catch (NoSuchMethodException ex) {
            throw new FatalBeanException(ex.getMessage(), ex);
        } catch (SecurityException ex) {
            throw new FatalBeanException(ex.getMessage(), ex);
        }
    }

    Iterator<Map.Entry<String, Compensable>> itr = compensables.entrySet().iterator();
    while (itr.hasNext()) {
        Map.Entry<String, Compensable> entry = itr.next();
        Compensable compensable = entry.getValue();
        Class<?> interfaceClass = compensable.interfaceClass();
        String confirmableKey = compensable.confirmableKey();
        String cancellableKey = compensable.cancellableKey();
        if (StringUtils.isNotBlank(confirmableKey)) {
            if (compensables.containsKey(confirmableKey)) {
                throw new FatalBeanException(String
                        .format("The confirm bean(id= %s) cannot be a compensable service!", confirmableKey));
            }
            Class<?> clazz = otherServiceMap.get(confirmableKey);
            if (clazz == null) {
                throw new IllegalStateException(
                        String.format("The confirm bean(id= %s) is not exists!", confirmableKey));
            }

            try {
                Method[] methodArray = interfaceClass.getDeclaredMethods();
                for (int j = 0; j < methodArray.length; j++) {
                    Method interfaceMethod = methodArray[j];
                    Method method = clazz.getMethod(interfaceMethod.getName(),
                            interfaceMethod.getParameterTypes());
                    this.validateDeclaredRemotingException(method, clazz);
                    this.validateTransactionalPropagation(method, clazz);
                    this.validateTransactionalRollbackFor(method, clazz, confirmableKey);
                }
            } catch (IllegalStateException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            } catch (NoSuchMethodException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            } catch (SecurityException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            }
        }

        if (StringUtils.isNotBlank(cancellableKey)) {
            if (compensables.containsKey(cancellableKey)) {
                throw new FatalBeanException(String
                        .format("The cancel bean(id= %s) cannot be a compensable service!", confirmableKey));
            }
            Class<?> clazz = otherServiceMap.get(cancellableKey);
            if (clazz == null) {
                throw new IllegalStateException(
                        String.format("The cancel bean(id= %s) is not exists!", cancellableKey));
            }

            try {
                Method[] methodArray = interfaceClass.getDeclaredMethods();
                for (int j = 0; j < methodArray.length; j++) {
                    Method interfaceMethod = methodArray[j];
                    Method method = clazz.getMethod(interfaceMethod.getName(),
                            interfaceMethod.getParameterTypes());
                    this.validateDeclaredRemotingException(method, clazz);
                    this.validateTransactionalPropagation(method, clazz);
                    this.validateTransactionalRollbackFor(method, clazz, cancellableKey);
                }
            } catch (IllegalStateException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            } catch (NoSuchMethodException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            } catch (SecurityException ex) {
                throw new FatalBeanException(ex.getMessage(), ex);
            }

        }
    }
}