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


Java PriorityOrdered類代碼示例

本文整理匯總了Java中org.springframework.core.PriorityOrdered的典型用法代碼示例。如果您正苦於以下問題:Java PriorityOrdered類的具體用法?Java PriorityOrdered怎麽用?Java PriorityOrdered使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: autowireByType

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
/**
 * Abstract method defining "autowire by type" (bean properties by type) behavior.
 * <p>This is like PicoContainer default, in which there must be exactly one bean
 * of the property type in the bean factory. This makes bean factories simple to
 * configure for small namespaces, but doesn't work as well as standard Spring
 * behavior for bigger applications.
 * @param beanName the name of the bean to autowire by type
 * @param mbd the merged bean definition to update through autowiring
 * @param bw BeanWrapper from which we can obtain information about the bean
 * @param pvs the PropertyValues to register wired objects with
 */
protected void autowireByType(
		String beanName, AbstractBeanDefinition mbd, BeanWrapper bw, MutablePropertyValues pvs) {

	TypeConverter converter = getCustomTypeConverter();
	if (converter == null) {
		converter = bw;
	}

	Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
	String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);
	for (String propertyName : propertyNames) {
		try {
			PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
			// Don't try autowiring by type for type Object: never makes sense,
			// even if it technically is a unsatisfied, non-simple property.
			if (!Object.class.equals(pd.getPropertyType())) {
				MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
				// Do not allow eager init for type matching in case of a prioritized post-processor.
				boolean eager = !PriorityOrdered.class.isAssignableFrom(bw.getWrappedClass());
				DependencyDescriptor desc = new AutowireByTypeDependencyDescriptor(methodParam, eager);
				Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);
				if (autowiredArgument != null) {
					pvs.add(propertyName, autowiredArgument);
				}
				for (String autowiredBeanName : autowiredBeanNames) {
					registerDependentBean(autowiredBeanName, beanName);
					if (logger.isDebugEnabled()) {
						logger.debug("Autowiring by type from bean name '" + beanName + "' via property '" +
								propertyName + "' to bean named '" + autowiredBeanName + "'");
					}
				}
				autowiredBeanNames.clear();
			}
		}
		catch (BeansException ex) {
			throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, propertyName, ex);
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:51,代碼來源:AbstractAutowireCapableBeanFactory.java

示例2: autowireByType

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
/**
 * Abstract method defining "autowire by type" (bean properties by type) behavior.
 * <p>This is like PicoContainer default, in which there must be exactly one bean
 * of the property type in the bean factory. This makes bean factories simple to
 * configure for small namespaces, but doesn't work as well as standard Spring
 * behavior for bigger applications.
 * @param beanName the name of the bean to autowire by type
 * @param mbd the merged bean definition to update through autowiring
 * @param bw BeanWrapper from which we can obtain information about the bean
 * @param pvs the PropertyValues to register wired objects with
 */
protected void autowireByType(
		String beanName, AbstractBeanDefinition mbd, BeanWrapper bw, MutablePropertyValues pvs) {

	TypeConverter converter = getCustomTypeConverter();
	if (converter == null) {
		converter = bw;
	}

	Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
	String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);
	for (String propertyName : propertyNames) {
		try {
			PropertyDescriptor pd = bw.getPropertyDescriptor(propertyName);
			// Don't try autowiring by type for type Object: never makes sense,
			// even if it technically is a unsatisfied, non-simple property.
			if (Object.class != pd.getPropertyType()) {
				MethodParameter methodParam = BeanUtils.getWriteMethodParameter(pd);
				// Do not allow eager init for type matching in case of a prioritized post-processor.
				boolean eager = !PriorityOrdered.class.isAssignableFrom(bw.getWrappedClass());
				DependencyDescriptor desc = new AutowireByTypeDependencyDescriptor(methodParam, eager);
				Object autowiredArgument = resolveDependency(desc, beanName, autowiredBeanNames, converter);
				if (autowiredArgument != null) {
					pvs.add(propertyName, autowiredArgument);
				}
				for (String autowiredBeanName : autowiredBeanNames) {
					registerDependentBean(autowiredBeanName, beanName);
					if (logger.isDebugEnabled()) {
						logger.debug("Autowiring by type from bean name '" + beanName + "' via property '" +
								propertyName + "' to bean named '" + autowiredBeanName + "'");
					}
				}
				autowiredBeanNames.clear();
			}
		}
		catch (BeansException ex) {
			throw new UnsatisfiedDependencyException(mbd.getResourceDescription(), beanName, propertyName, ex);
		}
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:51,代碼來源:AbstractAutowireCapableBeanFactory.java

示例3: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
@Override
public int getOrder() {
    return PriorityOrdered.HIGHEST_PRECEDENCE;
}
 
開發者ID:zzqfsy,項目名稱:spring-jwt-starter,代碼行數:5,代碼來源:DefaultRolesPrefixPostProcessor.java

示例4: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
@Override
public int getOrder() {

  return PriorityOrdered.HIGHEST_PRECEDENCE;
}
 
開發者ID:oasp,項目名稱:oasp-tutorial-sources,代碼行數:6,代碼來源:DefaultRolesPrefixPostProcessor.java

示例5: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
/**
 * 設置spring構建優先級
 */
@Override
public int getOrder() {
    return PriorityOrdered.HIGHEST_PRECEDENCE;
}
 
開發者ID:wangchongjie,項目名稱:multi-task,代碼行數:8,代碼來源:TaskBeanContainer.java

示例6: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
@Override
public int getOrder() {
	return PriorityOrdered.HIGHEST_PRECEDENCE + 1;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:5,代碼來源:ExposeInvocationInterceptor.java

示例7: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
public int getOrder() {
	return PriorityOrdered.HIGHEST_PRECEDENCE;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:4,代碼來源:EncodedUriTests.java

示例8: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
@Override
public int getOrder()
{
    return PriorityOrdered.HIGHEST_PRECEDENCE;
}
 
開發者ID:dhis2,項目名稱:dhis2-core,代碼行數:6,代碼來源:DefaultRolesPrefixPostProcessor.java

示例9: getOrder

import org.springframework.core.PriorityOrdered; //導入依賴的package包/類
@Override
public int getOrder()
{
	return PriorityOrdered.HIGHEST_PRECEDENCE; // bootstrap application before doing anything else
}
 
開發者ID:molgenis,項目名稱:molgenis,代碼行數:6,代碼來源:MolgenisBootstrapper.java


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