本文整理匯總了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;
}
示例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));
}