当前位置: 首页>>代码示例>>Java>>正文


Java GenericBeanDefinition.setSource方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.support.GenericBeanDefinition.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java GenericBeanDefinition.setSource方法的具体用法?Java GenericBeanDefinition.setSource怎么用?Java GenericBeanDefinition.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.support.GenericBeanDefinition的用法示例。


在下文中一共展示了GenericBeanDefinition.setSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createObjectMapperFactoryDefinition

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
private GenericBeanDefinition createObjectMapperFactoryDefinition(Object source) {
	GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
	beanDefinition.setBeanClass(Jackson2ObjectMapperFactoryBean.class);
	beanDefinition.setSource(source);
	beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	return beanDefinition;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:AnnotationDrivenBeanDefinitionParser.java

示例2: registerMessageConverter

import org.springframework.beans.factory.support.GenericBeanDefinition; //导入方法依赖的package包/类
private RuntimeBeanReference registerMessageConverter(Element element, ParserContext context, Object source) {
	Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
	ManagedList<? super Object> converters = new ManagedList<Object>();
	if (convertersElement != null) {
		converters.setSource(source);
		for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
			Object object = context.getDelegate().parsePropertySubElement(beanElement, null);
			converters.add(object);
		}
	}
	if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
		converters.setSource(source);
		converters.add(new RootBeanDefinition(StringMessageConverter.class));
		converters.add(new RootBeanDefinition(ByteArrayMessageConverter.class));
		if (jackson2Present) {
			RootBeanDefinition jacksonConverterDef = new RootBeanDefinition(MappingJackson2MessageConverter.class);
			RootBeanDefinition resolverDef = new RootBeanDefinition(DefaultContentTypeResolver.class);
			resolverDef.getPropertyValues().add("defaultMimeType", MimeTypeUtils.APPLICATION_JSON);
			jacksonConverterDef.getPropertyValues().add("contentTypeResolver", resolverDef);
			// Use Jackson factory in order to have JSR-310 and Joda-Time modules registered automatically
			GenericBeanDefinition jacksonFactoryDef = new GenericBeanDefinition();
			jacksonFactoryDef.setBeanClass(Jackson2ObjectMapperFactoryBean.class);
			jacksonFactoryDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
			jacksonFactoryDef.setSource(source);
			jacksonConverterDef.getPropertyValues().add("objectMapper", jacksonFactoryDef);
			converters.add(jacksonConverterDef);
		}
	}
	ConstructorArgumentValues cavs = new ConstructorArgumentValues();
	cavs.addIndexedArgumentValue(0, converters);
	RootBeanDefinition messageConverterDef = new RootBeanDefinition(CompositeMessageConverter.class, cavs, null);
	return new RuntimeBeanReference(registerBeanDef(messageConverterDef, context, source));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:34,代码来源:MessageBrokerBeanDefinitionParser.java


注:本文中的org.springframework.beans.factory.support.GenericBeanDefinition.setSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。