Java Code Examples for org.springframework.beans.factory.support.RootBeanDefinition#setResource()
The following examples show how to use
org.springframework.beans.factory.support.RootBeanDefinition#setResource() .
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: ConfigurationClassPostProcessorTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void postProcessorFailsOnImplicitOverrideIfOverridingIsNotAllowed() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); beanFactory.setAllowBeanDefinitionOverriding(false); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); try { pp.postProcessBeanFactory(beanFactory); fail("Should have thrown BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { assertTrue(ex.getMessage().contains("bar")); assertTrue(ex.getMessage().contains("SingletonBeanConfig")); assertTrue(ex.getMessage().contains(TestBean.class.getName())); } }
Example 2
Source File: ConfigurationClassPostProcessorTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void postProcessorFailsOnImplicitOverrideIfOverridingIsNotAllowed() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); beanFactory.setAllowBeanDefinitionOverriding(false); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); try { pp.postProcessBeanFactory(beanFactory); fail("Should have thrown BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { assertTrue(ex.getMessage().contains("bar")); assertTrue(ex.getMessage().contains("SingletonBeanConfig")); assertTrue(ex.getMessage().contains(TestBean.class.getName())); } }
Example 3
Source File: ConfigurationClassPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void postProcessorFailsOnImplicitOverrideIfOverridingIsNotAllowed() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); beanFactory.setAllowBeanDefinitionOverriding(false); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); try { pp.postProcessBeanFactory(beanFactory); fail("Should have thrown BeanDefinitionStoreException"); } catch (BeanDefinitionStoreException ex) { assertTrue(ex.getMessage().contains("bar")); assertTrue(ex.getMessage().contains("SingletonBeanConfig")); assertTrue(ex.getMessage().contains(TestBean.class.getName())); } }
Example 4
Source File: ConfigurationClassPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitions() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }
Example 5
Source File: ConfigurationClassPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitionsEvenWithScopedProxy() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy( new BeanDefinitionHolder(rbd, "bar"), beanFactory, true); beanFactory.registerBeanDefinition("bar", proxied.getBeanDefinition()); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }
Example 6
Source File: ConfigurationClassPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitions() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }
Example 7
Source File: ConfigurationClassPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitionsEvenWithScopedProxy() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy( new BeanDefinitionHolder(rbd, "bar"), beanFactory, true); beanFactory.registerBeanDefinition("bar", proxied.getBeanDefinition()); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }
Example 8
Source File: ConfigurationClassPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitions() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); beanFactory.registerBeanDefinition("bar", rbd); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }
Example 9
Source File: ConfigurationClassPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void postProcessorDoesNotOverrideRegularBeanDefinitionsEvenWithScopedProxy() { RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); rbd.setResource(new DescriptiveResource("XML or something")); BeanDefinitionHolder proxied = ScopedProxyUtils.createScopedProxy( new BeanDefinitionHolder(rbd, "bar"), beanFactory, true); beanFactory.registerBeanDefinition("bar", proxied.getBeanDefinition()); beanFactory.registerBeanDefinition("config", new RootBeanDefinition(SingletonBeanConfig.class)); ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor(); pp.postProcessBeanFactory(beanFactory); beanFactory.getBean("foo", Foo.class); beanFactory.getBean("bar", TestBean.class); }