Java Code Examples for org.springframework.beans.factory.support.RootBeanDefinition#setBeanClassName()
The following examples show how to use
org.springframework.beans.factory.support.RootBeanDefinition#setBeanClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsListenerContainerParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override protected RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition factoryDef = new RootBeanDefinition(); String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE); String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE); if (!"".equals(containerClass)) { return null; // Not supported } else if ("".equals(containerType) || containerType.startsWith("default")) { factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory"); } else if (containerType.startsWith("simple")) { factoryDef.setBeanClassName("org.springframework.jms.config.SimpleJmsListenerContainerFactory"); } factoryDef.getPropertyValues().addPropertyValues(commonContainerProperties); factoryDef.getPropertyValues().addPropertyValues(specificContainerProperties); return factoryDef; }
Example 2
Source File: JcaListenerContainerParser.java From spring-analysis-note with MIT License | 6 votes |
@Override protected RootBeanDefinition createContainer(Element containerEle, Element listenerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition containerDef = new RootBeanDefinition(); containerDef.setSource(parserContext.extractSource(containerEle)); containerDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsMessageEndpointManager"); containerDef.getPropertyValues().addPropertyValues(specificContainerProperties); RootBeanDefinition configDef = new RootBeanDefinition(); configDef.setSource(parserContext.extractSource(containerEle)); configDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsActivationSpecConfig"); configDef.getPropertyValues().addPropertyValues(commonContainerProperties); parseListenerConfiguration(listenerEle, parserContext, configDef.getPropertyValues()); containerDef.getPropertyValues().add("activationSpecConfig", configDef); return containerDef; }
Example 3
Source File: JmsListenerContainerParser.java From spring-analysis-note with MIT License | 6 votes |
@Override protected RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition factoryDef = new RootBeanDefinition(); String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE); String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE); if (!"".equals(containerClass)) { return null; // Not supported } else if ("".equals(containerType) || containerType.startsWith("default")) { factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJmsListenerContainerFactory"); } else if (containerType.startsWith("simple")) { factoryDef.setBeanClassName("org.springframework.jms.config.SimpleJmsListenerContainerFactory"); } factoryDef.getPropertyValues().addPropertyValues(commonContainerProperties); factoryDef.getPropertyValues().addPropertyValues(specificContainerProperties); return factoryDef; }
Example 4
Source File: JcaListenerContainerParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override protected RootBeanDefinition createContainer(Element containerEle, Element listenerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition containerDef = new RootBeanDefinition(); containerDef.setSource(parserContext.extractSource(containerEle)); containerDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsMessageEndpointManager"); containerDef.getPropertyValues().addPropertyValues(specificContainerProperties); RootBeanDefinition configDef = new RootBeanDefinition(); configDef.setSource(parserContext.extractSource(containerEle)); configDef.setBeanClassName("org.springframework.jms.listener.endpoint.JmsActivationSpecConfig"); configDef.getPropertyValues().addPropertyValues(commonContainerProperties); parseListenerConfiguration(listenerEle, parserContext, configDef.getPropertyValues()); containerDef.getPropertyValues().add("activationSpecConfig", configDef); return containerDef; }
Example 5
Source File: AnnotationDrivenCacheBeanDefinitionParser.java From lams with GNU General Public License v2.0 | 5 votes |
private static void registerCacheAspect(Element element, ParserContext parserContext) { if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)) { Object eleSource = parserContext.extractSource(element); RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(JCACHE_ASPECT_CLASS_NAME); def.setFactoryMethodName("aspectOf"); BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, eleSource); String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef); def.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName)); parserContext.registerBeanComponent(new BeanComponentDefinition(sourceDef, sourceName)); parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)); } }
Example 6
Source File: SpringConfiguredBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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; }
Example 7
Source File: SpringConfiguredBeanDefinitionParser.java From lams with GNU General Public License v2.0 | 5 votes |
@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; }
Example 8
Source File: AnnotationDrivenBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private void registerJtaTransactionAspect(Element element, ParserContext parserContext) { String txAspectBeanName = TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_BEAN_NAME; String txAspectClassName = TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_CLASS_NAME; if (!parserContext.getRegistry().containsBeanDefinition(txAspectBeanName)) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(txAspectClassName); def.setFactoryMethodName("aspectOf"); registerTransactionManager(element, def); parserContext.registerBeanComponent(new BeanComponentDefinition(def, txAspectBeanName)); } }
Example 9
Source File: AnnotationDrivenBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private void registerTransactionAspect(Element element, ParserContext parserContext) { String txAspectBeanName = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME; String txAspectClassName = TransactionManagementConfigUtils.TRANSACTION_ASPECT_CLASS_NAME; if (!parserContext.getRegistry().containsBeanDefinition(txAspectBeanName)) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(txAspectClassName); def.setFactoryMethodName("aspectOf"); registerTransactionManager(element, def); parserContext.registerBeanComponent(new BeanComponentDefinition(def, txAspectBeanName)); } }
Example 10
Source File: SpringConfiguredBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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; }
Example 11
Source File: JmsListenerContainerParser.java From java-technology-stack with MIT License | 5 votes |
@Override protected RootBeanDefinition createContainer(Element containerEle, Element listenerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition containerDef = new RootBeanDefinition(); containerDef.setSource(parserContext.extractSource(containerEle)); containerDef.getPropertyValues().addPropertyValues(commonContainerProperties); containerDef.getPropertyValues().addPropertyValues(specificContainerProperties); String containerType = containerEle.getAttribute(CONTAINER_TYPE_ATTRIBUTE); String containerClass = containerEle.getAttribute(CONTAINER_CLASS_ATTRIBUTE); if (!"".equals(containerClass)) { containerDef.setBeanClassName(containerClass); } else if ("".equals(containerType) || containerType.startsWith("default")) { containerDef.setBeanClassName("org.springframework.jms.listener.DefaultMessageListenerContainer"); } else if (containerType.startsWith("simple")) { containerDef.setBeanClassName("org.springframework.jms.listener.SimpleMessageListenerContainer"); } else { parserContext.getReaderContext().error( "Invalid 'container-type' attribute: only \"default\" and \"simple\" supported.", containerEle); } // Parse listener specific settings parseListenerConfiguration(listenerEle, parserContext, containerDef.getPropertyValues()); return containerDef; }
Example 12
Source File: SpringConfiguredBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
@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; }
Example 13
Source File: SpringConfiguredBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
@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; }
Example 14
Source File: AutowiredAnnotationBeanPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testGenericsBasedFieldInjectionWithSimpleMatchAndMockito() { RootBeanDefinition bd = new RootBeanDefinition(RepositoryFieldInjectionBeanWithSimpleMatch.class); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); bf.registerBeanDefinition("annotatedBean", bd); RootBeanDefinition rbd = new RootBeanDefinition(); rbd.setBeanClassName(Mockito.class.getName()); rbd.setFactoryMethodName("mock"); // TypedStringValue used to be equivalent to an XML-defined argument String rbd.getConstructorArgumentValues().addGenericArgumentValue(new TypedStringValue(Repository.class.getName())); bf.registerBeanDefinition("repo", rbd); RepositoryFieldInjectionBeanWithSimpleMatch bean = (RepositoryFieldInjectionBeanWithSimpleMatch) bf.getBean("annotatedBean"); Repository<?> repo = bf.getBean("repo", Repository.class); assertSame(repo, bean.repository); assertSame(repo, bean.stringRepository); assertSame(1, bean.repositoryArray.length); assertSame(1, bean.stringRepositoryArray.length); assertSame(repo, bean.repositoryArray[0]); assertSame(repo, bean.stringRepositoryArray[0]); assertSame(1, bean.repositoryList.size()); assertSame(1, bean.stringRepositoryList.size()); assertSame(repo, bean.repositoryList.get(0)); assertSame(repo, bean.stringRepositoryList.get(0)); assertSame(1, bean.repositoryMap.size()); assertSame(1, bean.stringRepositoryMap.size()); assertSame(repo, bean.repositoryMap.get("repo")); assertSame(repo, bean.stringRepositoryMap.get("repo")); }
Example 15
Source File: AnnotationDrivenCacheBeanDefinitionParser.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Registers a * <pre class="code"> * <bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf"> * <property name="cacheManager" ref="cacheManager"/> * <property name="keyGenerator" ref="keyGenerator"/> * </bean> * </pre> */ private static void registerCacheAspect(Element element, ParserContext parserContext) { if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(CACHE_ASPECT_CLASS_NAME); def.setFactoryMethodName("aspectOf"); parseCacheResolution(element, def, false); CacheNamespaceHandler.parseKeyGenerator(element, def); parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)); } }
Example 16
Source File: JcaListenerContainerParser.java From spring-analysis-note with MIT License | 5 votes |
@Override protected RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition factoryDef = new RootBeanDefinition(); factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJcaListenerContainerFactory"); factoryDef.getPropertyValues().addPropertyValues(commonContainerProperties); factoryDef.getPropertyValues().addPropertyValues(specificContainerProperties); return factoryDef; }
Example 17
Source File: AutowiredAnnotationBeanPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testGenericsBasedFieldInjectionWithSimpleMatchAndMockito() { DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); bf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver()); AutowiredAnnotationBeanPostProcessor bpp = new AutowiredAnnotationBeanPostProcessor(); bpp.setBeanFactory(bf); bf.addBeanPostProcessor(bpp); RootBeanDefinition bd = new RootBeanDefinition(RepositoryFieldInjectionBeanWithSimpleMatch.class); bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); bf.registerBeanDefinition("annotatedBean", bd); RootBeanDefinition rbd = new RootBeanDefinition(); rbd.setBeanClassName(Mockito.class.getName()); rbd.setFactoryMethodName("mock"); // TypedStringValue used to be equivalent to an XML-defined argument String rbd.getConstructorArgumentValues().addGenericArgumentValue(new TypedStringValue(Repository.class.getName())); bf.registerBeanDefinition("repo", rbd); RepositoryFieldInjectionBeanWithSimpleMatch bean = (RepositoryFieldInjectionBeanWithSimpleMatch) bf.getBean("annotatedBean"); Repository repo = bf.getBean("repo", Repository.class); assertSame(repo, bean.repository); assertSame(repo, bean.stringRepository); assertSame(1, bean.repositoryArray.length); assertSame(1, bean.stringRepositoryArray.length); assertSame(repo, bean.repositoryArray[0]); assertSame(repo, bean.stringRepositoryArray[0]); assertSame(1, bean.repositoryList.size()); assertSame(1, bean.stringRepositoryList.size()); assertSame(repo, bean.repositoryList.get(0)); assertSame(repo, bean.stringRepositoryList.get(0)); assertSame(1, bean.repositoryMap.size()); assertSame(1, bean.stringRepositoryMap.size()); assertSame(repo, bean.repositoryMap.get("repo")); assertSame(repo, bean.stringRepositoryMap.get("repo")); }
Example 18
Source File: AnnotationDrivenCacheBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Registers a * <pre class="code"> * <bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf"> * <property name="cacheManager" ref="cacheManager"/> * <property name="keyGenerator" ref="keyGenerator"/> * </bean> * </pre> */ private static void registerCacheAspect(Element element, ParserContext parserContext) { if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)) { RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(CACHE_ASPECT_CLASS_NAME); def.setFactoryMethodName("aspectOf"); parseCacheResolution(element, def, false); CacheNamespaceHandler.parseKeyGenerator(element, def); parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.CACHE_ASPECT_BEAN_NAME)); } }
Example 19
Source File: AnnotationDrivenCacheBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private static void registerCacheAspect(Element element, ParserContext parserContext) { if (!parserContext.getRegistry().containsBeanDefinition(CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)) { Object eleSource = parserContext.extractSource(element); RootBeanDefinition def = new RootBeanDefinition(); def.setBeanClassName(JCACHE_ASPECT_CLASS_NAME); def.setFactoryMethodName("aspectOf"); BeanDefinition sourceDef = createJCacheOperationSourceBeanDefinition(element, eleSource); String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef); def.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName)); parserContext.registerBeanComponent(new BeanComponentDefinition(sourceDef, sourceName)); parserContext.registerBeanComponent(new BeanComponentDefinition(def, CacheManagementConfigUtils.JCACHE_ASPECT_BEAN_NAME)); } }
Example 20
Source File: JcaListenerContainerParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext, PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) { RootBeanDefinition factoryDef = new RootBeanDefinition(); factoryDef.setBeanClassName("org.springframework.jms.config.DefaultJcaListenerContainerFactory"); factoryDef.getPropertyValues().addPropertyValues(commonContainerProperties); factoryDef.getPropertyValues().addPropertyValues(specificContainerProperties); return factoryDef; }