本文整理汇总了Java中org.springframework.beans.factory.support.RootBeanDefinition.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java RootBeanDefinition.setSource方法的具体用法?Java RootBeanDefinition.setSource怎么用?Java RootBeanDefinition.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.support.RootBeanDefinition
的用法示例。
在下文中一共展示了RootBeanDefinition.setSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAdvisorBeanDefinition
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
/**
* Create a {@link RootBeanDefinition} for the advisor described in the supplied. Does <strong>not</strong>
* parse any associated '{@code pointcut}' or '{@code pointcut-ref}' attributes.
*/
private AbstractBeanDefinition createAdvisorBeanDefinition(Element advisorElement, ParserContext parserContext) {
RootBeanDefinition advisorDefinition = new RootBeanDefinition(DefaultBeanFactoryPointcutAdvisor.class);
advisorDefinition.setSource(parserContext.extractSource(advisorElement));
String adviceRef = advisorElement.getAttribute(ADVICE_REF);
if (!StringUtils.hasText(adviceRef)) {
parserContext.getReaderContext().error(
"'advice-ref' attribute contains empty value.", advisorElement, this.parseState.snapshot());
}
else {
advisorDefinition.getPropertyValues().add(
ADVICE_BEAN_NAME, new RuntimeBeanNameReference(adviceRef));
}
if (advisorElement.hasAttribute(ORDER_PROPERTY)) {
advisorDefinition.getPropertyValues().add(
ORDER_PROPERTY, advisorElement.getAttribute(ORDER_PROPERTY));
}
return advisorDefinition;
}
示例2: registerOrEscalateApcAsRequired
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry, Object source) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
if (registry.containsBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME)) {
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
if (!cls.getName().equals(apcDefinition.getBeanClassName())) {
int currentPriority = findPriorityForClass(apcDefinition.getBeanClassName());
int requiredPriority = findPriorityForClass(cls);
if (currentPriority < requiredPriority) {
apcDefinition.setBeanClassName(cls.getName());
}
}
return null;
}
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
beanDefinition.setSource(source);
beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
return beanDefinition;
}
示例3: doParse
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
private synchronized void doParse(Element element, ParserContext parserContext) {
String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute("base-package"), ",; \t\n");
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
if (!parserContext.getRegistry().containsBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)) {
Object eleSource = parserContext.extractSource(element);
RootBeanDefinition configMapDef = new RootBeanDefinition(ConcurrentHashMap.class);
configMapDef.setSource(eleSource);
configMapDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String configMapName = parserContext.getReaderContext().registerWithGeneratedName(configMapDef);
RootBeanDefinition interceptorDef = new RootBeanDefinition(JetCacheInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
interceptorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
RootBeanDefinition advisorDef = new RootBeanDefinition(CacheAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("adviceBeanName", interceptorName));
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("basePackages", basePackages));
parserContext.getRegistry().registerBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(configMapDef, configMapName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheAdvisor.CACHE_ADVISOR_BEAN_NAME));
parserContext.registerComponent(compositeDef);
}
}
示例4: registerBeanDefinitions
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
Assert.notNull(importingClassMetadata, "AnnotationMetadata must not be null!");
Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");
// Guard against calls for sub-classes
//if (importingClassMetadata.getAnnotationAttributes(getAnnotation().getName()) == null) {
// return;
//}
RootBeanDefinition repositoryInterfacePostProcessor = new RootBeanDefinition(REPOSITORY_INTERFACE_POST_PROCESSOR);
repositoryInterfacePostProcessor.setSource(importingClassMetadata);
registry.registerBeanDefinition(REPOSITORY_INTERFACE_POST_PROCESSOR, repositoryInterfacePostProcessor);
BeanDefinition storeServiceBeanDef = createBeanDefinition(ContentStoreServiceImpl.class);
registry.registerBeanDefinition("contentStoreService", storeServiceBeanDef);
BeanDefinition annotatedStoreEventHandlerDef = createBeanDefinition(AnnotatedStoreEventInvoker.class);
registry.registerBeanDefinition("annotatedStoreEventHandler", annotatedStoreEventHandlerDef);
BeanDefinition renditionServiceBeanDef = createBeanDefinition(RenditionServiceImpl.class);
registry.registerBeanDefinition("renditionService", renditionServiceBeanDef);
createOperationsBean(registry);
registerContentStoreBeanDefinitions(importingClassMetadata, registry);
}
示例5: registerUrlProvider
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
private void registerUrlProvider(ParserContext parserContext, Object source) {
if (!parserContext.getRegistry().containsBeanDefinition(RESOURCE_URL_PROVIDER)) {
RootBeanDefinition urlProvider = new RootBeanDefinition(ResourceUrlProvider.class);
urlProvider.setSource(source);
urlProvider.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parserContext.getRegistry().registerBeanDefinition(RESOURCE_URL_PROVIDER, urlProvider);
parserContext.registerComponent(new BeanComponentDefinition(urlProvider, RESOURCE_URL_PROVIDER));
RootBeanDefinition interceptor = new RootBeanDefinition(ResourceUrlProviderExposingInterceptor.class);
interceptor.setSource(source);
interceptor.getConstructorArgumentValues().addIndexedArgumentValue(0, urlProvider);
RootBeanDefinition mappedInterceptor = new RootBeanDefinition(MappedInterceptor.class);
mappedInterceptor.setSource(source);
mappedInterceptor.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
mappedInterceptor.getConstructorArgumentValues().addIndexedArgumentValue(0, (Object) null);
mappedInterceptor.getConstructorArgumentValues().addIndexedArgumentValue(1, interceptor);
String mappedInterceptorName = parserContext.getReaderContext().registerWithGeneratedName(mappedInterceptor);
parserContext.registerComponent(new BeanComponentDefinition(mappedInterceptor, mappedInterceptorName));
}
}
示例6: registerUrlPathHelper
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
/**
* Adds an alias to an existing well-known name or registers a new instance of a {@link UrlPathHelper}
* under that well-known name, unless already registered.
* @return a RuntimeBeanReference to this {@link UrlPathHelper} instance
*/
public static RuntimeBeanReference registerUrlPathHelper(RuntimeBeanReference urlPathHelperRef, ParserContext parserContext, Object source) {
if (urlPathHelperRef != null) {
if (parserContext.getRegistry().isAlias(URL_PATH_HELPER_BEAN_NAME)) {
parserContext.getRegistry().removeAlias(URL_PATH_HELPER_BEAN_NAME);
}
parserContext.getRegistry().registerAlias(urlPathHelperRef.getBeanName(), URL_PATH_HELPER_BEAN_NAME);
}
else if (!parserContext.getRegistry().isAlias(URL_PATH_HELPER_BEAN_NAME)
&& !parserContext.getRegistry().containsBeanDefinition(URL_PATH_HELPER_BEAN_NAME)) {
RootBeanDefinition urlPathHelperDef = new RootBeanDefinition(UrlPathHelper.class);
urlPathHelperDef.setSource(source);
urlPathHelperDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parserContext.getRegistry().registerBeanDefinition(URL_PATH_HELPER_BEAN_NAME, urlPathHelperDef);
parserContext.registerComponent(new BeanComponentDefinition(urlPathHelperDef, URL_PATH_HELPER_BEAN_NAME));
}
return new RuntimeBeanReference(URL_PATH_HELPER_BEAN_NAME);
}
示例7: registerPathMatcher
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
/**
* Adds an alias to an existing well-known name or registers a new instance of a {@link PathMatcher}
* under that well-known name, unless already registered.
* @return a RuntimeBeanReference to this {@link PathMatcher} instance
*/
public static RuntimeBeanReference registerPathMatcher(RuntimeBeanReference pathMatcherRef, ParserContext parserContext, Object source) {
if (pathMatcherRef != null) {
if (parserContext.getRegistry().isAlias(PATH_MATCHER_BEAN_NAME)) {
parserContext.getRegistry().removeAlias(PATH_MATCHER_BEAN_NAME);
}
parserContext.getRegistry().registerAlias(pathMatcherRef.getBeanName(), PATH_MATCHER_BEAN_NAME);
}
else if (!parserContext.getRegistry().isAlias(PATH_MATCHER_BEAN_NAME)
&& !parserContext.getRegistry().containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) {
RootBeanDefinition pathMatcherDef = new RootBeanDefinition(AntPathMatcher.class);
pathMatcherDef.setSource(source);
pathMatcherDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parserContext.getRegistry().registerBeanDefinition(PATH_MATCHER_BEAN_NAME, pathMatcherDef);
parserContext.registerComponent(new BeanComponentDefinition(pathMatcherDef, PATH_MATCHER_BEAN_NAME));
}
return new RuntimeBeanReference(PATH_MATCHER_BEAN_NAME);
}
示例8: getRedirectView
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
private RootBeanDefinition getRedirectView(Element element, HttpStatus status, Object source) {
RootBeanDefinition redirectView = new RootBeanDefinition(RedirectView.class);
redirectView.setSource(source);
redirectView.getConstructorArgumentValues().addIndexedArgumentValue(0, element.getAttribute("redirect-url"));
if (status != null) {
redirectView.getPropertyValues().add("statusCode", status);
}
if (element.hasAttribute("context-relative")) {
redirectView.getPropertyValues().add("contextRelative", element.getAttribute("context-relative"));
}
else {
redirectView.getPropertyValues().add("contextRelative", true);
}
if (element.hasAttribute("keep-query-params")) {
redirectView.getPropertyValues().add("propagateQueryParams", element.getAttribute("keep-query-params"));
}
return redirectView;
}
示例9: createContentNegotiatingViewResolver
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
private BeanDefinition createContentNegotiatingViewResolver(Element resolverElement, ParserContext context) {
RootBeanDefinition beanDef = new RootBeanDefinition(ContentNegotiatingViewResolver.class);
beanDef.setSource(context.extractSource(resolverElement));
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
MutablePropertyValues values = beanDef.getPropertyValues();
List<Element> elements = DomUtils.getChildElementsByTagName(resolverElement, new String[] {"default-views"});
if (!elements.isEmpty()) {
ManagedList<Object> list = new ManagedList<Object>();
for (Element element : DomUtils.getChildElementsByTagName(elements.get(0), "bean", "ref")) {
list.add(context.getDelegate().parsePropertySubElement(element, null));
}
values.add("defaultViews", list);
}
if (resolverElement.hasAttribute("use-not-acceptable")) {
values.add("useNotAcceptableStatusCode", resolverElement.getAttribute("use-not-acceptable"));
}
Object manager = getContentNegotiationManager(context);
if (manager != null) {
values.add("contentNegotiationManager", manager);
}
return beanDef;
}
示例10: registerBeansForRoot
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
@Override
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) {
super.registerBeansForRoot(registry, config);
if (!registry.containsBeanDefinition("documentDbMappingContext")) {
final RootBeanDefinition definition = new RootBeanDefinition(DocumentDbMappingContext.class);
definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE);
definition.setSource(config.getSource());
registry.registerBeanDefinition("documentDbMappingContext", definition);
}
}
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:13,代码来源:DocumentDbRepositoryConfigurationExtension.java
示例11: registerBeansForRoot
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
@Override
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) {
String tarantolSyncOpsRef = configurationSource.getAttribute("tarantoolSyncOpsRef");
// register context
RootBeanDefinition mappingContextDefinition = createTarantoolMappingContext();
mappingContextDefinition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(mappingContextDefinition, registry, MAPPING_CONTEXT_BEAN_NAME, configurationSource);
// Register converter
RootBeanDefinition redisConverterDefinition = createTarantoolConverterDefinition();
redisConverterDefinition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(redisConverterDefinition, registry, TARANTOOL_CONVERTER_BEAN_NAME, configurationSource);
// register tarantoolOpsImpl
RootBeanDefinition tarantoolOpsImplDefinition = new RootBeanDefinition(TarantoolOpsImpl.class);
ConstructorArgumentValues constructorArgumentValuesForTarantoolOpsImpl = new ConstructorArgumentValues();
if (StringUtils.hasText(tarantolSyncOpsRef)) {
constructorArgumentValuesForTarantoolOpsImpl.addIndexedArgumentValue(0,
new RuntimeBeanReference(tarantolSyncOpsRef));
}
tarantoolOpsImplDefinition.setConstructorArgumentValues(constructorArgumentValuesForTarantoolOpsImpl);
registerIfNotAlreadyRegistered(tarantoolOpsImplDefinition, registry, TARANTOOL_OPS_IMPL_BEAN_NAME,
configurationSource);
super.registerBeansForRoot(registry, configurationSource);
}
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:32,代码来源:TarantoolRepositoryConfigurationExtension.java
示例12: configureAutoProxyCreator
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
String txAdvisorBeanName = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME;
if (!parserContext.getRegistry().containsBeanDefinition(txAdvisorBeanName)) {
Object eleSource = parserContext.extractSource(element);
// Create the TransactionAttributeSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition(
"org.springframework.transaction.annotation.AnnotationTransactionAttributeSource");
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the TransactionInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(TransactionInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
registerTransactionManager(element, interceptorDef);
interceptorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the TransactionAttributeSourceAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryTransactionAttributeSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("transactionAttributeSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
if (element.hasAttribute("order")) {
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
}
parserContext.getRegistry().registerBeanDefinition(txAdvisorBeanName, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, txAdvisorBeanName));
parserContext.registerComponent(compositeDef);
}
}
示例13: parse
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) {
RootBeanDefinition def = new RootBeanDefinition();
def.setBeanClassName(BEAN_CONFIGURER_ASPECT_CLASS_NAME);
def.setFactoryMethodName("aspectOf");
def.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
def.setSource(parserContext.extractSource(element));
parserContext.registerBeanComponent(new BeanComponentDefinition(def, BEAN_CONFIGURER_ASPECT_BEAN_NAME));
}
return null;
}
示例14: configureAutoProxyCreator
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
if (!parserContext.getRegistry().containsBeanDefinition(CACHE_ADVISOR_BEAN_NAME)) {
Object eleSource = parserContext.extractSource(element);
// Create the CacheOperationSource definition.
RootBeanDefinition sourceDef = new RootBeanDefinition(AnnotationCacheOperationSource.class);
sourceDef.setSource(eleSource);
sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
// Create the CacheInterceptor definition.
RootBeanDefinition interceptorDef = new RootBeanDefinition(CacheInterceptor.class);
interceptorDef.setSource(eleSource);
interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
parseCacheManagerProperty(element, interceptorDef);
CacheNamespaceHandler.parseKeyGenerator(element, interceptorDef);
interceptorDef.getPropertyValues().add("cacheOperationSources", new RuntimeBeanReference(sourceName));
String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);
// Create the CacheAdvisor definition.
RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryCacheOperationSourceAdvisor.class);
advisorDef.setSource(eleSource);
advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
if (element.hasAttribute("order")) {
advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
}
parserContext.getRegistry().registerBeanDefinition(CACHE_ADVISOR_BEAN_NAME, advisorDef);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
eleSource);
compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CACHE_ADVISOR_BEAN_NAME));
parserContext.registerComponent(compositeDef);
}
}
示例15: registerBeansForRoot
import org.springframework.beans.factory.support.RootBeanDefinition; //导入方法依赖的package包/类
@Override
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) {
super.registerBeansForRoot(registry, configurationSource);
RootBeanDefinition mappingContextDefinition = new RootBeanDefinition(ObjectifyMappingContext.class);
mappingContextDefinition.setSource(configurationSource.getSource());
registerIfNotAlreadyRegistered(mappingContextDefinition, registry, MAPPING_CONTEXT_BEAN_NAME, configurationSource);
}
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:10,代码来源:ObjectifyRepositoryConfigurationExtension.java