org.springframework.beans.factory.xml.XmlBeanFactory Java Examples
The following examples show how to use
org.springframework.beans.factory.xml.XmlBeanFactory.
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: FactoryUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static IntegrationContextFactory lookup() throws Exception { // the instance is provided by Spring-injection if (useLocator) { SpringBeanLocator locator = SpringBeanLocator.getInstance(); return (IntegrationContextFactory) locator.getBean("integrationContextFactory"); } else // unit testing { Resource res = new ClassPathResource(CONFIGURATION); BeanFactory factory = new XmlBeanFactory(res); return (IntegrationContextFactory) factory.getBean("integrationContextFactory"); } }
Example #2
Source File: FactoryUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static SamigoApiFactory lookup() throws Exception { // the instance is provided by Spring-injection if (useLocator) { SpringBeanLocator locator = SpringBeanLocator.getInstance(); return (SamigoApiFactory) locator.getBean("samigoApiFactory"); } else // unit testing { Resource res = new ClassPathResource(CONFIGURATION); BeanFactory factory = new XmlBeanFactory(res); return (SamigoApiFactory) factory.getBean("samigoApiFactory"); } }
Example #3
Source File: FactoryUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static IntegrationContextFactory lookup() throws Exception { // the instance is provided by Spring-injection if (useLocator) { SpringBeanLocator locator = SpringBeanLocator.getInstance(); return (IntegrationContextFactory) locator.getBean("integrationContextFactory"); } else // unit testing { Resource res = new ClassPathResource(CONFIGURATION); BeanFactory factory = new XmlBeanFactory(res); return (IntegrationContextFactory) factory.getBean("integrationContextFactory"); } }
Example #4
Source File: FactoryUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static SamigoApiFactory lookup() throws Exception { // the instance is provided by Spring-injection if (useLocator) { SpringBeanLocator locator = SpringBeanLocator.getInstance(); return (SamigoApiFactory) locator.getBean("samigoApiFactory"); } else // unit testing { Resource res = new ClassPathResource(CONFIGURATION); BeanFactory factory = new XmlBeanFactory(res); return (SamigoApiFactory) factory.getBean("samigoApiFactory"); } }
Example #5
Source File: SpringFactory.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
private static XmlBeanFactory getBeanFactory() { File outerContextFile = new File(OUTER_APPLICATION_CONTEXT); boolean outerContextFileProper = outerContextFile.exists() && outerContextFile.isFile() && outerContextFile.canRead(); Resource res = (outerContextFileProper) ? new FileSystemResource( outerContextFile) : new ClassPathResource( INNER_APPLICATION_CONTEXT); return new XmlBeanFactory(res); }
Example #6
Source File: IOCContainerAppUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void whenBFInitialized_thenStudentNotInitialized() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); assertFalse(Student.isBeanInstantiated()); }
Example #7
Source File: IOCContainerAppUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void whenBFInitialized_thenStudentInitialized() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Student student = (Student) factory.getBean("student"); assertTrue(Student.isBeanInstantiated()); }
Example #8
Source File: IOCContainerAppUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void whenBFInitialized_thenBFPProcessorAndBPProcessorNotRegAutomatically() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); assertFalse(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); assertFalse(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); }
Example #9
Source File: IOCContainerAppUnitTest.java From tutorials with MIT License | 5 votes |
@Test public void whenBFPostProcessorAndBPProcessorRegisteredManually_thenReturnTrue() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); beanFactoryPostProcessor.postProcessBeanFactory(factory); assertTrue(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); factory.addBeanPostProcessor(beanPostProcessor); Student student = (Student) factory.getBean("student"); assertTrue(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); }
Example #10
Source File: BeanFactoryWithClassPathResourceIntegrationTest.java From tutorials with MIT License | 5 votes |
@Test public void createBeanFactoryAndCheckEmployeeBean() { Resource res = new ClassPathResource("beanfactory-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Employee emp = (Employee) factory.getBean("employee"); assertTrue(factory.isSingleton("employee")); assertTrue(factory.getBean("employee") instanceof Employee); assertTrue(factory.isTypeMatch("employee", Employee.class)); assertTrue(factory.getAliases("employee").length > 0); }
Example #11
Source File: ProductTest.java From S-mall-ssm with GNU General Public License v3.0 | 4 votes |
@Test public void getProduct() throws Exception { productService.get(5); System.out.println("test"); BeanFactory bf = new XmlBeanFactory(new ClassPathResource("")); }
Example #12
Source File: GridUriDeploymentSpringDocument.java From ignite with Apache License 2.0 | 4 votes |
/** * Creates new instance of configuration helper with given configuration. * * @param factory Configuration factory. */ GridUriDeploymentSpringDocument(XmlBeanFactory factory) { assert factory != null; this.factory = factory; }