类org.springframework.beans.factory.xml.XmlBeanFactory源码实例Demo

下面列出了怎么用org.springframework.beans.factory.xml.XmlBeanFactory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: sakai   文件: FactoryUtil.java
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");
  }

}
 
源代码2 项目: sakai   文件: FactoryUtil.java
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");
  }

}
 
源代码3 项目: sakai   文件: FactoryUtil.java
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");
  }

}
 
源代码4 项目: sakai   文件: FactoryUtil.java
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");
  }

}
 
源代码5 项目: dkpro-jwpl   文件: SpringFactory.java
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);
}
 
源代码6 项目: tutorials   文件: IOCContainerAppUnitTest.java
@Test
public void whenBFInitialized_thenStudentNotInitialized() {
    Resource res = new ClassPathResource("ioc-container-difference-example.xml");
    BeanFactory factory = new XmlBeanFactory(res);
    
    assertFalse(Student.isBeanInstantiated());
}
 
源代码7 项目: tutorials   文件: IOCContainerAppUnitTest.java
@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());
}
 
源代码8 项目: tutorials   文件: IOCContainerAppUnitTest.java
@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());
}
 
源代码9 项目: tutorials   文件: IOCContainerAppUnitTest.java
@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());
}
 
@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);
}
 
源代码11 项目: S-mall-ssm   文件: ProductTest.java
@Test
public void getProduct() throws Exception {
    productService.get(5);
    System.out.println("test");
    BeanFactory bf = new XmlBeanFactory(new ClassPathResource(""));
}
 
源代码12 项目: ignite   文件: GridUriDeploymentSpringDocument.java
/**
 * Creates new instance of configuration helper with given configuration.
 *
 * @param factory Configuration factory.
 */
GridUriDeploymentSpringDocument(XmlBeanFactory factory) {
    assert factory != null;

    this.factory = factory;
}
 
 类方法
 同包方法