當前位置: 首頁>>代碼示例>>Java>>正文


Java BeanDefinition.setDependsOn方法代碼示例

本文整理匯總了Java中org.springframework.beans.factory.config.BeanDefinition.setDependsOn方法的典型用法代碼示例。如果您正苦於以下問題:Java BeanDefinition.setDependsOn方法的具體用法?Java BeanDefinition.setDependsOn怎麽用?Java BeanDefinition.setDependsOn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.beans.factory.config.BeanDefinition的用法示例。


在下文中一共展示了BeanDefinition.setDependsOn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addSyntheticDependsOn

import org.springframework.beans.factory.config.BeanDefinition; //導入方法依賴的package包/類
private void addSyntheticDependsOn(BeanDefinition definition, String beanName) {
	if (StringUtils.hasText(beanName)) {
		String[] dependsOn = definition.getDependsOn();
		if (dependsOn != null && dependsOn.length > 0) {
			for (String dependOn : dependsOn) {
				if (beanName.equals(dependOn)) {
					return;
				}
			}
		}

		// add depends on
		dependsOn = (String[]) ObjectUtils.addObjectToArray(dependsOn, beanName);
		definition.setDependsOn(dependsOn);
		Collection<String> markers = (Collection<String>) definition.getAttribute(SYNTHETIC_DEPENDS_ON);
		if (markers == null) {
			markers = new ArrayList<String>(2);
			definition.setAttribute(SYNTHETIC_DEPENDS_ON, markers);
		}
		markers.add(beanName);
	}
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:23,代碼來源:CycleOrderingProcessor.java

示例2: postProcessBeanFactory

import org.springframework.beans.factory.config.BeanDefinition; //導入方法依賴的package包/類
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    String[] autoInitBeanNames = beanFactory.getBeanNamesForType(AbstractCacheAutoInit.class, false, false);
    if (autoInitBeanNames != null) {
        BeanDefinition bd = beanFactory.getBeanDefinition(JetCacheAutoConfiguration.GLOBAL_CACHE_CONFIG_NAME);
        String[] dependsOn = bd.getDependsOn();
        if (dependsOn == null) {
            dependsOn = new String[0];
        }
        int oldLen = dependsOn.length;
        dependsOn = Arrays.copyOf(dependsOn, dependsOn.length + autoInitBeanNames.length);
        System.arraycopy(autoInitBeanNames,0, dependsOn, oldLen, autoInitBeanNames.length);
        bd.setDependsOn(dependsOn);
    }
}
 
開發者ID:alibaba,項目名稱:jetcache,代碼行數:16,代碼來源:BeanDependencyManager.java


注:本文中的org.springframework.beans.factory.config.BeanDefinition.setDependsOn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。