List of usage examples for org.springframework.beans.factory.config RuntimeBeanReference RuntimeBeanReference
public RuntimeBeanReference(Class<?> beanType)
From source file:org.hdiv.config.xml.ConfigBeanDefinitionParser.java
private RootBeanDefinition createDataValidatorFactory(Element element, Object source) { RootBeanDefinition bean = new RootBeanDefinition(DataValidatorFactory.class); bean.setSource(source);//from ww w . j av a2 s .c o m bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); bean.getPropertyValues().addPropertyValue("hdivConfig", new RuntimeBeanReference("config")); return bean; }
From source file:org.hdiv.config.xml.ConfigBeanDefinitionParser.java
private RootBeanDefinition createDataComposerFactory(Element element, Object source) { RootBeanDefinition bean = new RootBeanDefinition(DataComposerFactory.class); bean.setSource(source);//from w ww . j ava 2 s . c o m bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); bean.getPropertyValues().addPropertyValue("hdivConfig", new RuntimeBeanReference("config")); bean.getPropertyValues().addPropertyValue("session", new RuntimeBeanReference("sessionHDIV")); bean.getPropertyValues().addPropertyValue("encodingUtil", new RuntimeBeanReference("encoding")); bean.getPropertyValues().addPropertyValue("stateUtil", new RuntimeBeanReference("stateUtil")); bean.getPropertyValues().addPropertyValue("uidGenerator", new RuntimeBeanReference("uidGenerator")); bean.getPropertyValues().addPropertyValue("allowedLength", "4000"); return bean; }
From source file:com.dianping.avatar.cache.spring.CacheBeanDefinitionParser.java
/** * Register {@link XMLCacheClientFactory} definition *//* w w w .j ava2 s . com*/ private void registerDefaultCacheClientFactory(BeanDefinitionRegistry beanDefinitionRegistry) { GenericBeanDefinition definition = new GenericBeanDefinition(); definition.setBeanClass(RemoteCacheClientFactory.class); definition.setLazyInit(true); MutablePropertyValues propertyValues = definition.getPropertyValues(); propertyValues.addPropertyValue("configurationWebService", new RuntimeBeanReference(CACHE_CONFIGURATION_WEB_SERVICE_ID)); BeanDefinitionReaderUtils.registerBeanDefinition( new BeanDefinitionHolder(definition, DEFAULT_CACHE_CLIENT_FACTORY_ID), beanDefinitionRegistry); }
From source file:de.acosix.alfresco.utility.common.spring.PropertyAlteringBeanFactoryPostProcessor.java
protected Object handleMapValues(final PropertyValue configuredValue) { final Object value; LOGGER.debug(/*from w ww . j av a 2 s .c o m*/ "[{}] Map of values / bean reference names has been configured - treating property {} of {} as <map>", this.beanName, this.propertyName, this.targetBeanName); final ManagedMap<Object, Object> map = new ManagedMap<>(); if (this.merge && configuredValue != null) { final Object configuredValueDefinition = configuredValue.getValue(); if (configuredValueDefinition instanceof ManagedMap<?, ?>) { final ManagedMap<?, ?> oldMap = (ManagedMap<?, ?>) configuredValueDefinition; map.setKeyTypeName(oldMap.getKeyTypeName()); map.setValueTypeName(oldMap.getValueTypeName()); map.setMergeEnabled(oldMap.isMergeEnabled()); map.setSource(oldMap.getSource()); map.putAll(oldMap); LOGGER.debug("[{}] Merged existing map values: {}", this.beanName, oldMap); } } Map<Object, Object> valuesToMap; if (this.valueMap != null) { LOGGER.debug("[{}] Map of configured values for {} of {}: ", this.beanName, this.propertyName, this.targetBeanName, this.valueMap); valuesToMap = this.valueMap; } else { LOGGER.debug("[{}] Map of configured bean reference names for {} of {}: ", this.beanName, this.propertyName, this.targetBeanName, this.beanReferenceNameMap); valuesToMap = new HashMap<>(); for (final Entry<Object, String> beanReferenceEntry : this.beanReferenceNameMap.entrySet()) { valuesToMap.put(beanReferenceEntry.getKey(), new RuntimeBeanReference(beanReferenceEntry.getValue())); } } LOGGER.debug("[{}] Putting new entries into map for {} of {}", this.beanName, this.propertyName, this.targetBeanName); map.putAll(valuesToMap); if (!map.isMergeEnabled() && this.mergeParent) { LOGGER.debug("[{}] Enabling \"merge\" for <map> on {} of {}", this.beanName, this.propertyName, this.targetBeanName); } map.setMergeEnabled(map.isMergeEnabled() || this.mergeParent); value = map; return value; }
From source file:org.hdiv.config.xml.ConfigBeanDefinitionParser.java
private RootBeanDefinition createValidatorHelper(Element element, Object source) { RootBeanDefinition bean = new RootBeanDefinition(ValidatorHelperRequest.class); bean.setSource(source);//w ww . j a v a2 s . c o m bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); bean.setInitMethodName("init"); bean.getPropertyValues().addPropertyValue("logger", new RuntimeBeanReference("logger")); bean.getPropertyValues().addPropertyValue("stateUtil", new RuntimeBeanReference("stateUtil")); bean.getPropertyValues().addPropertyValue("hdivConfig", new RuntimeBeanReference("config")); bean.getPropertyValues().addPropertyValue("session", new RuntimeBeanReference("sessionHDIV")); bean.getPropertyValues().addPropertyValue("dataValidatorFactory", new RuntimeBeanReference("dataValidatorFactory")); bean.getPropertyValues().addPropertyValue("dataComposerFactory", new RuntimeBeanReference("dataComposerFactory")); return bean; }
From source file:com.googlecode.ehcache.annotations.config.AnnotationDrivenEhCacheBeanDefinitionParser.java
/** * Create the {@link Pointcut} used to apply the caching interceptor * // w w w . java 2s . c o m * @return Reference to the {@link Pointcut}. Should never be null. */ protected RuntimeBeanReference setupPointcut(Element element, ParserContext parserContext, Object elementSource, RuntimeBeanReference cacheAttributeSource) { final RootBeanDefinition pointcut = new RootBeanDefinition(CacheStaticMethodMatcherPointcut.class); pointcut.setSource(elementSource); pointcut.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); final MutablePropertyValues propertyValues = pointcut.getPropertyValues(); propertyValues.addPropertyValue("cacheAttributeSource", cacheAttributeSource); final XmlReaderContext readerContext = parserContext.getReaderContext(); final String pointcutBeanName = readerContext.registerWithGeneratedName(pointcut); return new RuntimeBeanReference(pointcutBeanName); }
From source file:org.hdiv.config.xml.ConfigBeanDefinitionParser.java
private RootBeanDefinition createLinkUrlProcessor(Element element, Object source) { RootBeanDefinition bean = new RootBeanDefinition(LinkUrlProcessor.class); bean.setSource(source);// ww w. jav a 2 s . com bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); bean.getPropertyValues().addPropertyValue("config", new RuntimeBeanReference("config")); return bean; }
From source file:com.googlecode.ehcache.annotations.config.AnnotationDrivenEhCacheBeanDefinitionParser.java
/** * Create {@link MethodInterceptor} that is applies the caching logic to advised methods. * /*from ww w .ja v a 2 s. c o m*/ * @return Reference to the {@link MethodInterceptor}. Should never be null. */ protected RuntimeBeanReference setupInterceptor(Element element, ParserContext parserContext, Object elementSource, RuntimeBeanReference cacheableAttributeSourceRuntimeReference) { final RootBeanDefinition interceptor = new RootBeanDefinition(EhCacheInterceptor.class); interceptor.setSource(elementSource); interceptor.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); final MutablePropertyValues propertyValues = interceptor.getPropertyValues(); propertyValues.addPropertyValue("cacheAttributeSource", cacheableAttributeSourceRuntimeReference); final XmlReaderContext readerContext = parserContext.getReaderContext(); final String interceptorBeanName = readerContext.registerWithGeneratedName(interceptor); return new RuntimeBeanReference(interceptorBeanName); }
From source file:org.hdiv.config.xml.ConfigBeanDefinitionParser.java
private RootBeanDefinition createFormUrlProcessor(Element element, Object source) { RootBeanDefinition bean = new RootBeanDefinition(FormUrlProcessor.class); bean.setSource(source);//from w w w. j a va2 s .co m bean.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); bean.getPropertyValues().addPropertyValue("config", new RuntimeBeanReference("config")); return bean; }
From source file:com.dianping.avatar.cache.spring.CacheBeanDefinitionParser.java
/** * @param parserContext/*from w w w . j av a 2 s. c o m*/ * */ private void registerDefaultCacheItemConfigManager(BeanDefinitionRegistry beanDefinitionRegistry) { GenericBeanDefinition definition = new GenericBeanDefinition(); definition.setBeanClass(RemoteCacheItemConfigManager.class); // lazy init because default CacheItemConfigManager is not required definition.setLazyInit(true); MutablePropertyValues propertyValues = definition.getPropertyValues(); propertyValues.addPropertyValue("configurationWebService", new RuntimeBeanReference(CACHE_CONFIGURATION_WEB_SERVICE_ID)); BeanDefinitionReaderUtils.registerBeanDefinition( new BeanDefinitionHolder(definition, DEFAULT_ITEM_CONFIG_MANAGER_ID), beanDefinitionRegistry); }