当前位置: 首页>>代码示例>>Java>>正文


Java XmlBeanDefinitionReader.loadBeanDefinitions方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions方法的典型用法代码示例。如果您正苦于以下问题:Java XmlBeanDefinitionReader.loadBeanDefinitions方法的具体用法?Java XmlBeanDefinitionReader.loadBeanDefinitions怎么用?Java XmlBeanDefinitionReader.loadBeanDefinitions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.xml.XmlBeanDefinitionReader的用法示例。


在下文中一共展示了XmlBeanDefinitionReader.loadBeanDefinitions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();

	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	SpringBlueprintConverterService converterService =
			new SpringBlueprintConverterService(null, context.getBeanFactory());
	converterService.add(new GenericConverter());
	context.getBeanFactory().setConversionService(converterService);

	reader = new XmlBeanDefinitionReader(context);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();

	blueprintContainer = new SpringBlueprintContainer(context);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:19,代码来源:GenericsTest.java

示例2: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	BundleContext bundleContext = new MockBundleContext() {
		// service reference already registered
		public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
			return new ServiceReference[] { new MockServiceReference(new String[] { Serializable.class.getName() }) };
		}
	};

	appContext = new GenericApplicationContext();
	appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	appContext.setClassLoader(getClass().getClassLoader());

	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
	reader.loadBeanDefinitions(new ClassPathResource("osgiDefaults.xml", getClass()));
	appContext.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:17,代码来源:OsgiDefaultsTests.java

示例3: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();
	applicationContext = new GenericApplicationContext();
	applicationContext.setClassLoader(getClass().getClassLoader());
	applicationContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	applicationContext.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {

		public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
			beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
		}
	});
	reader = new XmlBeanDefinitionReader(applicationContext);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(getConfig(), getClass()));
	applicationContext.refresh();
	blueprintContainer = new SpringBlueprintContainer(applicationContext);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:18,代码来源:BaseMetadataTest.java

示例4: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();

	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {

		public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
			beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
		}
	});

	reader = new XmlBeanDefinitionReader(context);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();

	blueprintContainer = new SpringBlueprintContainer(context);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:21,代码来源:NestedDefinitionMetadataTest.java

示例5: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();

	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	context.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {

		public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
			beanFactory.addPropertyEditorRegistrar(new BlueprintEditorRegistrar());
			beanFactory.registerSingleton("blueprintContainer",
					new SpringBlueprintContainer(context));
		}
	});

	reader = new XmlBeanDefinitionReader(context);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();

	blueprintContainer = new SpringBlueprintContainer(context);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:23,代码来源:TestLazyBeansTest.java

示例6: main

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
        ClassPathResource classPathResource = new ClassPathResource("beans.xml");
        DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);

        reader.loadBeanDefinitions(classPathResource);

        Person person = factory.getBean("person",Person.class);
        System.out.println(person.getHand());

        System.out.println(person.getName());
        System.out.println(classPathResource.getURL());
        System.out.println(classPathResource.getFile().getAbsolutePath());

        String fileUrl = classPathResource.getFile().getAbsolutePath();
        ApplicationContext context = new FileSystemXmlApplicationContext("/Users/fahai/soft/project/meta/src/main/resources/beans.xml");
        Person person1 = (Person) factory.getBean("person");
//        System.out.println(person1.getName());
//        DefaultListableBeanFactory


    }
 
开发者ID:programTang,项目名称:meta,代码行数:23,代码来源:TestDefaultListableBeanFactory.java

示例7: testGenericApplicationContextWithXmlBeanDefinitionsAndClassLoaderNull

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
@Test
public void testGenericApplicationContextWithXmlBeanDefinitionsAndClassLoaderNull() {
	GenericApplicationContext ctx = new GenericApplicationContext();
	ctx.setClassLoader(null);
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx);
	reader.loadBeanDefinitions(new ClassPathResource(CONTEXT_B, getClass()));
	reader.loadBeanDefinitions(new ClassPathResource(CONTEXT_C, getClass()));
	reader.loadBeanDefinitions(new ClassPathResource(CONTEXT_A, getClass()));
	ctx.refresh();
	assertEquals(ObjectUtils.identityToString(ctx), ctx.getId());
	assertEquals(ObjectUtils.identityToString(ctx), ctx.getDisplayName());
	assertTrue(ctx.containsBean("service"));
	assertTrue(ctx.containsBean("logicOne"));
	assertTrue(ctx.containsBean("logicTwo"));
	ctx.close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:ClassPathXmlApplicationContextTests.java

示例8: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();
	context = new GenericApplicationContext();
	context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	context.setClassLoader(getClass().getClassLoader());
	reader = new XmlBeanDefinitionReader(context);
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:NestedElementsTest.java

示例9: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	reader = new XmlBeanDefinitionReader(context);
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:8,代码来源:MixedRfc124BeansTest.java

示例10: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    admin = createMock(ConfigurationAdmin.class);
    Configuration cfg = createMock(Configuration.class);

    Dictionary config = new Hashtable();

    expect(admin.getConfiguration("com.xyz.myapp")).andReturn(cfg).atLeastOnce();
    expect(cfg.getProperties()).andReturn(config).atLeastOnce();

    replay(admin, cfg);

    BundleContext bundleContext = new MockBundleContext() {

        // add Configuration admin support
        public Object getService(ServiceReference reference) {
            return admin;
        }
    };

    GenericApplicationContext appContext = new GenericApplicationContext();
    appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));

    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
    // reader.setEventListener(this.listener);
    reader.loadBeanDefinitions(new ClassPathResource("osgiPropertyPlaceholder.xml", getClass()));
    appContext.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:28,代码来源:CmConfigAndCtxPropertiesConfigurationTest.java

示例11: refresh

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
private void refresh() {
	replay(installBundle, startBundle, updateBundle);

	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
	reader.loadBeanDefinitions(new ClassPathResource("bundleBeanFactoryTest.xml", getClass()));

	appContext.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:9,代码来源:BundleFactoryBeanParserTest.java

示例12: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	reader = new XmlBeanDefinitionReader(context);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:9,代码来源:SchemaWithLocationTest.java

示例13: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	bundleContext = new MockBundleContext();

	context = new GenericApplicationContext();
	context.setClassLoader(getClass().getClassLoader());
	context.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));
	context.addBeanFactoryPostProcessor(new CycleOrderingProcessor());
	reader = new XmlBeanDefinitionReader(context);
	reader.setDocumentLoader(new PublicBlueprintDocumentLoader());
	reader.loadBeanDefinitions(new ClassPathResource(CONFIG, getClass()));
	context.refresh();

	blueprintContainer = new SpringBlueprintContainer(context);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:CycleTest.java

示例14: testInvalidDefaultsCheck

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
public void testInvalidDefaultsCheck() throws Exception {
	XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
	
	try {
		reader.loadBeanDefinitions(new ClassPathResource("osgiInvalidDefaults.xml", getClass()));
		fail("should have failed since osgi:defaults cannot be used outside the root element");
	}
	catch (BeanDefinitionParsingException ex) {
		// expected
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:InvalidOsgiDefaultsTest.java

示例15: setUp

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; //导入方法依赖的package包/类
protected void setUp() throws Exception {

		services.clear();

		RegistrationListener.BIND_CALLS = 0;
		RegistrationListener.UNBIND_CALLS = 0;

		CustomRegistrationListener.REG_CALLS = 0;
		CustomRegistrationListener.UNREG_CALLS = 0;

		registration = new MockServiceRegistration();

		bundleContext = new MockBundleContext() {

			public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
				return new ServiceReference[] { new MockServiceReference(new String[] { Cloneable.class.getName() }) };
			}

			public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
				services.add(service);
				return registration;
			}
		};

		appContext = new GenericApplicationContext();
		appContext.getBeanFactory().addBeanPostProcessor(new BundleContextAwareProcessor(bundleContext));

		XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
		// reader.setEventListener(this.listener);
		reader.loadBeanDefinitions(new ClassPathResource("osgiServiceNamespaceHandlerTests.xml", getClass()));
		appContext.refresh();
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:33,代码来源:OsgiServiceNamespaceHandlerTest.java


注:本文中的org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。