当前位置: 首页>>代码示例>>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;未经允许,请勿转载。