List of usage examples for org.springframework.beans.factory.config ConfigurableListableBeanFactory getBeanDefinition
BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;
From source file:com.mtgi.analytics.aop.config.v11.BtManagerBeanDefinitionParser.java
@Override protected void transform(ConfigurableListableBeanFactory factory, BeanDefinition template, Element element, ParserContext parserContext) {//from w w w .j a va2 s. c o m ManagerComponentDefinition def = (ManagerComponentDefinition) parserContext.getContainingComponent(); String managerId = overrideAttribute(ATT_ID, template, element); if (managerId == null) template.setAttribute(ATT_ID, managerId = "defaultTrackingManager"); if ("false".equals(element.getAttribute(ATT_ENABLED))) { //manager is disabled. replace definition with dummy instance. template.setBeanClassName(DisabledBehaviorTrackingManager.class.getName()); //clear properties and attributes. for (String att : template.attributeNames()) if (!ATT_ID.equals(att)) template.removeAttribute(att); template.getPropertyValues().clear(); //terminate immediately, do not parse any nested definitions (persisters, AOP config, context beans, etc) return; } overrideProperty(ATT_APPLICATION, template, element, false); overrideProperty(ATT_FLUSH_THRESHOLD, template, element, false); //wake up MBeanExporter if we're going to be doing MBean registration. if ("true".equalsIgnoreCase(element.getAttribute(ATT_REGISTER_MBEANS))) { AbstractBeanDefinition exporter = (AbstractBeanDefinition) factory .getBeanDefinition(CONFIG_MBEAN_EXPORTER); exporter.setLazyInit(false); //append manager ID to mbean name, in case of multiple managers in a single application. BeanDefinition naming = factory.getBeanDefinition(CONFIG_NAMING_STRATEGY); naming.getPropertyValues().addPropertyValue("value", managerId); } //prefer references to beans in the parent factory if they've been specified if (element.hasAttribute(ATT_MBEAN_SERVER)) factory.registerAlias(element.getAttribute(ATT_MBEAN_SERVER), CONFIG_MBEAN_SERVER); if (element.hasAttribute(ATT_SCHEDULER)) factory.registerAlias(element.getAttribute(ATT_SCHEDULER), CONFIG_SCHEDULER); if (element.hasAttribute(ATT_TASK_EXECUTOR)) factory.registerAlias(element.getAttribute(ATT_TASK_EXECUTOR), CONFIG_EXECUTOR); //make note of external persister element so that we don't activate log rotation. if (element.hasAttribute(ATT_PERSISTER)) { def.addNestedProperty(ATT_PERSISTER); MutablePropertyValues props = template.getPropertyValues(); props.removePropertyValue(ATT_PERSISTER); props.addPropertyValue(ATT_PERSISTER, new RuntimeBeanReference(element.getAttribute(ATT_PERSISTER))); } if (element.hasAttribute(ATT_SESSION_CONTEXT)) { //override default session context with reference def.addNestedProperty("sessionContext"); factory.registerAlias(element.getAttribute(ATT_SESSION_CONTEXT), CONFIG_SESSION_CONTEXT); } //handle AOP configuration if needed if (element.hasAttribute(ATT_METHOD_EXPRESSION)) { //activate global AOP proxying if it hasn't already been done (borrowed logic from AopNamespaceHandler / config element parser) activateAopProxies(parserContext, element); //register pointcut definition for the provided expression. RootBeanDefinition pointcut = new RootBeanDefinition(AspectJExpressionPointcut.class); //rely on deprecated method to maintain spring 2.0 support pointcut.setSingleton(false); pointcut.setSynthetic(true); pointcut.getPropertyValues().addPropertyValue("expression", element.getAttribute(ATT_METHOD_EXPRESSION)); //create implicit pointcut advice bean. RootBeanDefinition advice = new RootBeanDefinition(BehaviorTrackingAdvice.class); advice.getPropertyValues().addPropertyValue("trackingManager", new RuntimeBeanReference(managerId)); //register advice, pointcut, and advisor entry to bind the two together. XmlReaderContext ctx = parserContext.getReaderContext(); String pointcutId = ctx.registerWithGeneratedName(pointcut); String adviceId = ctx.registerWithGeneratedName(advice); RootBeanDefinition advisorDefinition = new RootBeanDefinition(DefaultBeanFactoryPointcutAdvisor.class); advisorDefinition.getPropertyValues().addPropertyValue("adviceBeanName", new RuntimeBeanNameReference(adviceId)); advisorDefinition.getPropertyValues().addPropertyValue("pointcut", new RuntimeBeanReference(pointcutId)); ctx.registerWithGeneratedName(advisorDefinition); } //configure flush trigger and job to be globally unique based on manager name. BeanDefinition flushTrigger = factory.getBeanDefinition("com.mtgi.analytics.btFlushTrigger"); SchedulerActivationPostProcessor.configureTriggerDefinition(flushTrigger, element.getAttribute(ATT_FLUSH_SCHEDULE), managerId + "_flush"); //set up a post-processor to register the flush job with the selected scheduler instance. the job and scheduler //come from the template factory, but the post-processor runs when the currently-parsing factory is finished. SchedulerActivationPostProcessor.registerPostProcessor(parserContext, factory, CONFIG_SCHEDULER, CONFIG_NAMESPACE + ".btFlushTrigger"); //ManagerComponentDefinition is a flag to nested parsers that they should push their parsed bean definitions into //the manager bean definition. for example, see BtPersisterBeanDefinitionParser. //descend on nested child nodes to pick up persister and session context configuration NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node node = children.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { String namespaceUri = node.getNamespaceURI(); NamespaceHandler handler = parserContext.getReaderContext().getNamespaceHandlerResolver() .resolve(namespaceUri); ParserContext nestedCtx = new ParserContext(parserContext.getReaderContext(), parserContext.getDelegate(), template); nestedCtx.pushContainingComponent(def); handler.parse((Element) node, nestedCtx); } } if (!def.nestedProperties.contains(ATT_PERSISTER)) { //no persister registered. schedule default log rotation trigger. BtXmlPersisterBeanDefinitionParser.configureLogRotation(parserContext, factory, null); } if (!def.nestedProperties.contains("sessionContext")) { //custom session context not registered. select appropriate default class //depending on whether we are in a web context or not. if (parserContext.getReaderContext().getReader().getResourceLoader() instanceof WebApplicationContext) { BeanDefinition scDef = factory.getBeanDefinition(CONFIG_SESSION_CONTEXT); scDef.setBeanClassName(SpringSessionContext.class.getName()); } } }
From source file:de.acosix.alfresco.mtsupport.repo.subsystems.TenantAwareSubsystemPlaceholderConfigurer.java
/** * {@inheritDoc}/*from w w w.j ava 2 s . com*/ */ @Override protected void doProcessProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final StringValueResolver valueResolver) { final BeanDefinitionVisitor visitor = new BeanDefinitionVisitor(valueResolver) { /** * {@inheritDoc} */ @Override protected Object resolveValue(final Object value) { Object result = value; // TODO Report bug with Spring // TypedStringValue may be reused as result of cloneBeanDefinition and thus should not be mutated if (value instanceof TypedStringValue) { final TypedStringValue typedStringValue = (TypedStringValue) value; final String stringValue = typedStringValue.getValue(); if (stringValue != null) { final String visitedString = this.resolveStringValue(stringValue); if (!stringValue.equals(visitedString)) { result = typedStringValue.hasTargetType() ? new TypedStringValue(visitedString, typedStringValue.getTargetType()) : new TypedStringValue(visitedString); } } } else { result = super.resolveValue(value); } return result; } }; final String[] beanNames = beanFactoryToProcess.getBeanDefinitionNames(); for (final String curName : beanNames) { // Check that we're not parsing our own bean definition, // to avoid failing on unresolvable placeholders in properties file locations. if (!(curName.equals(this.beanName) && beanFactoryToProcess.equals(this.beanFactory))) { final String tenantDomain; if (curName.contains(TenantBeanUtils.TENANT_BEAN_NAME_PATTERN)) { tenantDomain = curName.substring(curName.indexOf(TenantBeanUtils.TENANT_BEAN_NAME_PATTERN) + TenantBeanUtils.TENANT_BEAN_NAME_PATTERN.length()); LOGGER.debug("[{}] Processing bean {} for tenant domain {}", this.beanName, curName, tenantDomain); } else { LOGGER.debug("[{}] Processing bean {} without tenant domain", this.beanName, curName); tenantDomain = null; } final BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(curName); TENANT_CONTEXT.set(tenantDomain); try { visitor.visitBeanDefinition(bd); } catch (final Exception ex) { throw new BeanDefinitionStoreException(bd.getResourceDescription(), curName, ex.getMessage()); } finally { TENANT_CONTEXT.remove(); } } } LOGGER.debug("[{}] Completed processing all beans", this.beanName); // New in Spring 2.5: resolve placeholders in alias target names and aliases as well. beanFactoryToProcess.resolveAliases(valueResolver); // New in Spring 3.0: resolve placeholders in embedded values such as annotation attributes. beanFactoryToProcess.addEmbeddedValueResolver(valueResolver); }
From source file:org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityPostProcessor.java
/** * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) */// w w w. ja v a 2s . c o m @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { for (String bean : getSecurityBeanNames(beanFactory)) { if (beanFactory.containsBeanDefinition(bean)) { if (logger.isDebugEnabled()) { logger.debug("Adding RM method security definitions for " + bean); } BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); PropertyValue beanValue = beanDef.getPropertyValues() .getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); if (beanValue != null) { String beanStringValue = (String) ((TypedStringValue) beanValue.getValue()).getValue(); String mergedStringValue = merge(beanStringValue); beanDef.getPropertyValues().addPropertyValue(PROP_OBJECT_DEFINITION_SOURCE, new TypedStringValue(mergedStringValue)); } } } }
From source file:org.alfresco.repo.management.subsystems.LegacyConfigPostProcessor.java
@SuppressWarnings("unchecked") public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { try {//from www . j a v a 2 s. c om // Look up the global-properties bean and its locations list MutablePropertyValues globalProperties = beanFactory .getBeanDefinition(LegacyConfigPostProcessor.BEAN_NAME_GLOBAL_PROPERTIES).getPropertyValues(); PropertyValue pv = globalProperties.getPropertyValue(LegacyConfigPostProcessor.PROPERTY_LOCATIONS); Collection<Object> globalPropertyLocations; Object value; // Use the locations list if there is one, otherwise associate a new empty list if (pv != null && (value = pv.getValue()) != null && value instanceof Collection) { globalPropertyLocations = (Collection<Object>) value; } else { globalPropertyLocations = new ManagedList(10); globalProperties.addPropertyValue(LegacyConfigPostProcessor.PROPERTY_LOCATIONS, globalPropertyLocations); } // Move location paths added to repository-properties MutablePropertyValues repositoryProperties = processLocations(beanFactory, globalPropertyLocations, LegacyConfigPostProcessor.BEAN_NAME_REPOSITORY_PROPERTIES, new String[] { "classpath:alfresco/version.properties" }); // Fix up additional properties to enforce correct order of precedence repositoryProperties.addPropertyValue("ignoreUnresolvablePlaceholders", Boolean.TRUE); repositoryProperties.addPropertyValue("localOverride", Boolean.FALSE); repositoryProperties.addPropertyValue("valueSeparator", null); repositoryProperties.addPropertyValue("systemPropertiesModeName", "SYSTEM_PROPERTIES_MODE_NEVER"); // Move location paths added to hibernateConfigProperties MutablePropertyValues hibernateProperties = processLocations(beanFactory, globalPropertyLocations, LegacyConfigPostProcessor.BEAN_NAME_HIBERNATE_PROPERTIES, new String[] { "classpath:alfresco/domain/hibernate-cfg.properties", "classpath*:alfresco/enterprise/cache/hibernate-cfg.properties" }); // Fix up additional properties to enforce correct order of precedence hibernateProperties.addPropertyValue("localOverride", Boolean.TRUE); // Because Spring gets all post processors in one shot, the bean may already have been created. Let's try to // fix it up! PropertyPlaceholderConfigurer repositoryConfigurer = (PropertyPlaceholderConfigurer) beanFactory .getSingleton(LegacyConfigPostProcessor.BEAN_NAME_REPOSITORY_PROPERTIES); if (repositoryConfigurer != null) { // Reset locations list repositoryConfigurer.setLocations(null); // Invalidate cached merged bean definitions ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition( LegacyConfigPostProcessor.BEAN_NAME_REPOSITORY_PROPERTIES, beanFactory.getBeanDefinition(LegacyConfigPostProcessor.BEAN_NAME_REPOSITORY_PROPERTIES)); // Reconfigure the bean according to its new definition beanFactory.configureBean(repositoryConfigurer, LegacyConfigPostProcessor.BEAN_NAME_REPOSITORY_PROPERTIES); } } catch (NoSuchBeanDefinitionException e) { // Ignore and continue } }
From source file:org.alfresco.repo.management.subsystems.LegacyConfigPostProcessor.java
/** * Given a bean name (assumed to implement {@link org.springframework.core.io.support.PropertiesLoaderSupport}) * checks whether it already references the <code>global-properties</code> bean. If not, 'upgrades' the bean by * appending all additional resources it mentions in its <code>locations</code> property to * <code>globalPropertyLocations</code>, except for those resources mentioned in <code>newLocations</code>. A * reference to <code>global-properties</code> will then be added and the resource list in * <code>newLocations<code> will then become the new <code>locations</code> list for the bean. * //w ww . jav a 2s . c om * @param beanFactory * the bean factory * @param globalPropertyLocations * the list of global property locations to be appended to * @param beanName * the bean name * @param newLocations * the new locations to be set on the bean * @return the mutable property values */ @SuppressWarnings("unchecked") private MutablePropertyValues processLocations(ConfigurableListableBeanFactory beanFactory, Collection<Object> globalPropertyLocations, String beanName, String[] newLocations) { // Get the bean an check its existing properties value MutablePropertyValues beanProperties = beanFactory.getBeanDefinition(beanName).getPropertyValues(); PropertyValue pv = beanProperties.getPropertyValue(LegacyConfigPostProcessor.PROPERTY_PROPERTIES); Object value; // If the properties value already references the global-properties bean, we have nothing else to do. Otherwise, // we have to 'upgrade' the bean definition. if (pv == null || (value = pv.getValue()) == null || !(value instanceof BeanReference) || ((BeanReference) value).getBeanName() .equals(LegacyConfigPostProcessor.BEAN_NAME_GLOBAL_PROPERTIES)) { // Convert the array of new locations to a managed list of type string values, so that it is // compatible with a bean definition Collection<Object> newLocationList = new ManagedList(newLocations.length); if (newLocations != null && newLocations.length > 0) { for (String preserveLocation : newLocations) { newLocationList.add(new TypedStringValue(preserveLocation)); } } // If there is currently a locations list, process it pv = beanProperties.getPropertyValue(LegacyConfigPostProcessor.PROPERTY_LOCATIONS); if (pv != null && (value = pv.getValue()) != null && value instanceof Collection) { Collection<Object> locations = (Collection<Object>) value; // Compute the set of locations that need to be added to globalPropertyLocations (preserving order) and // warn about each Set<Object> addedLocations = new LinkedHashSet<Object>(locations); addedLocations.removeAll(globalPropertyLocations); addedLocations.removeAll(newLocationList); for (Object location : addedLocations) { LegacyConfigPostProcessor.logger.warn("Legacy configuration detected: adding " + (location instanceof TypedStringValue ? ((TypedStringValue) location).getValue() : location.toString()) + " to global-properties definition"); globalPropertyLocations.add(location); } } // Ensure the bean now references global-properties beanProperties.addPropertyValue(LegacyConfigPostProcessor.PROPERTY_PROPERTIES, new RuntimeBeanReference(LegacyConfigPostProcessor.BEAN_NAME_GLOBAL_PROPERTIES)); // Ensure the new location list is now set on the bean if (newLocationList.size() > 0) { beanProperties.addPropertyValue(LegacyConfigPostProcessor.PROPERTY_LOCATIONS, newLocationList); } else { beanProperties.removePropertyValue(LegacyConfigPostProcessor.PROPERTY_LOCATIONS); } } return beanProperties; }
From source file:org.alfresco.util.BeanExtender.java
/** * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) *///from w w w . ja v a 2s . c o m @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { ParameterCheck.mandatory("beanName", beanName); ParameterCheck.mandatory("extendingBeanName", extendingBeanName); // check for bean name if (!beanFactory.containsBean(beanName)) { throw new NoSuchBeanDefinitionException("Can't find bean '" + beanName + "' to be extended."); } // check for extending bean if (!beanFactory.containsBean(extendingBeanName)) { throw new NoSuchBeanDefinitionException("Can't find bean '" + extendingBeanName + "' that is going to extend original bean definition."); } // get the bean definitions BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); BeanDefinition extendingBeanDefinition = beanFactory.getBeanDefinition(extendingBeanName); // update class if (StringUtils.isNotBlank(extendingBeanDefinition.getBeanClassName()) && !beanDefinition.getBeanClassName().equals(extendingBeanDefinition.getBeanClassName())) { beanDefinition.setBeanClassName(extendingBeanDefinition.getBeanClassName()); } // update properties MutablePropertyValues properties = beanDefinition.getPropertyValues(); MutablePropertyValues extendingProperties = extendingBeanDefinition.getPropertyValues(); for (PropertyValue propertyValue : extendingProperties.getPropertyValueList()) { properties.add(propertyValue.getName(), propertyValue.getValue()); } }
From source file:org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.java
/** * Prepares Spring context.// w w w. ja va2s . 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.bytesoft.bytejta.supports.dubbo.TransactionConfigPostProcessor.java
public void initializeForConsumer(ConfigurableListableBeanFactory beanFactory, String application, String targetBeanName) throws BeansException { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; // <dubbo:reference id="yyy" // interface="org.bytesoft.bytejta.supports.wire.RemoteCoordinator" // timeout="6000" group="org.bytesoft.bytejta" loadbalance="transaction" cluster="failfast" /> GenericBeanDefinition beanDef = new GenericBeanDefinition(); beanDef.setBeanClass(com.alibaba.dubbo.config.spring.ReferenceBean.class); MutablePropertyValues mpv = beanDef.getPropertyValues(); mpv.addPropertyValue("interface", RemoteCoordinator.class.getName()); mpv.addPropertyValue("timeout", "6000"); mpv.addPropertyValue("cluster", "failfast"); mpv.addPropertyValue("loadbalance", "transaction"); mpv.addPropertyValue("group", "org.bytesoft.bytejta"); mpv.addPropertyValue("check", "false"); String stubBeanId = String.format("stub@%s", RemoteCoordinator.class.getName()); registry.registerBeanDefinition(stubBeanId, beanDef); // <bean id="xxx" class="org.bytesoft.bytejta.supports.dubbo.TransactionBeanRegistry" // factory-method="getInstance"> // <property name="consumeCoordinator" ref="yyy" /> // </bean> BeanDefinition targetBeanDef = beanFactory.getBeanDefinition(targetBeanName); MutablePropertyValues targetMpv = targetBeanDef.getPropertyValues(); targetMpv.addPropertyValue("consumeCoordinator", new RuntimeBeanReference(stubBeanId)); }
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 a va 2 s .co 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!"); }/*from w w w . java 2s.c o m*/ } 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); }