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


Java ResourceXmlApplicationContext类代码示例

本文整理汇总了Java中org.apache.xbean.spring.context.ResourceXmlApplicationContext的典型用法代码示例。如果您正苦于以下问题:Java ResourceXmlApplicationContext类的具体用法?Java ResourceXmlApplicationContext怎么用?Java ResourceXmlApplicationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceXmlApplicationContext类属于org.apache.xbean.spring.context包,在下文中一共展示了ResourceXmlApplicationContext类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createApplicationContext

import org.apache.xbean.spring.context.ResourceXmlApplicationContext; //导入依赖的package包/类
@Override
protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
	Resource resource = Utils.resourceFromString(uri);
	LOG.debug("Using " + resource + " from " + uri);
	try {
		return new ResourceXmlApplicationContext(resource) {
			@Override
			protected ConfigurableEnvironment createEnvironment() {
				return new ReversePropertySourcesStandardServletEnvironment();
			}

			@Override
			protected void initPropertySources() {
				WebApplicationContextUtils.initServletPropertySources(getEnvironment().getPropertySources(),
						ServletContextHolder.getServletContext());
			}
		};
	} catch (FatalBeanException errorToLog) {
		LOG.error("Failed to load: " + resource + ", reason: " + errorToLog.getLocalizedMessage(), errorToLog);
		throw errorToLog;
	}
}
 
开发者ID:Hevelian,项目名称:hevelian-activemq,代码行数:23,代码来源:WebXBeanBrokerFactory.java

示例2: getContext

import org.apache.xbean.spring.context.ResourceXmlApplicationContext; //导入依赖的package包/类
public ApplicationContext getContext(InputStream is, WorkflowModelImpl model) {
	InputStreamResource isr = new InputStreamResource(is);
	try {
		ResourceXmlApplicationContext ctx = new ResourceXmlApplicationContext(isr, getPreprocessors(),
				parentContext, Collections.emptyList(), false);// {
		ctx.setValidating(false);
		ctx.refresh();
		return ctx;
	} finally {
		try {
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:aedelmann,项目名称:jiva,代码行数:17,代码来源:SpringWorkflowModelStore.java

示例3: createApplicationContext_envInstanceOfReversePropertySourcesStandardServletEnvironment

import org.apache.xbean.spring.context.ResourceXmlApplicationContext; //导入依赖的package包/类
@Test
public void createApplicationContext_envInstanceOfReversePropertySourcesStandardServletEnvironment()
		throws MalformedURLException {
	ServletContextHolder.setServletContext(Mockito.mock(ServletContext.class));
	ApplicationContext c = new WebXBeanBrokerFactory().createApplicationContext("classpath:activemq.xml");
	assertTrue(c instanceof ResourceXmlApplicationContext);
	try (ResourceXmlApplicationContext rc = (ResourceXmlApplicationContext) c) {
		assertTrue(rc.getEnvironment() instanceof ReversePropertySourcesStandardServletEnvironment);
	}
}
 
开发者ID:Hevelian,项目名称:hevelian-activemq,代码行数:11,代码来源:WebXBeanBrokerFactoryTest.java

示例4: createApplicationContext

import org.apache.xbean.spring.context.ResourceXmlApplicationContext; //导入依赖的package包/类
protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
    Resource resource = Utils.resourceFromString(uri);
    LOG.debug("Using " + resource + " from " + uri);
    try {
        return new ResourceXmlApplicationContext(resource) {
            @Override
            protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
                reader.setValidating(isValidate());
            }
        };
    } catch (FatalBeanException errorToLog) {
        LOG.error("Failed to load: " + resource + ", reason: " + errorToLog.getLocalizedMessage(), errorToLog);
        throw errorToLog;
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:16,代码来源:XBeanBrokerFactory.java

示例5: afterPropertiesSet

import org.apache.xbean.spring.context.ResourceXmlApplicationContext; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
    if (config == null) {
        throw new IllegalArgumentException("config property must be set");
    }
    context = new ResourceXmlApplicationContext(config, parentContext);

    try {
        broker = (XBeanBrokerService)context.getBean("broker");
    } catch (BeansException e) {
        // ignore...
        // log.trace("No bean named broker available: " + e, e);
    }
    if (broker == null) {
        // lets try find by type
        String[] names = context.getBeanNamesForType(BrokerService.class);
        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            broker = (XBeanBrokerService)context.getBean(name);
            if (broker != null) {
                break;
            }
        }
    }
    if (broker == null) {
        throw new IllegalArgumentException("The configuration has no BrokerService instance for resource: " + config);
    }
    
    if( systemExitOnShutdown ) {
        broker.addShutdownHook(new Runnable(){
            public void run() {
                System.exit(systemExitOnShutdownExitCode);
            }
        });
    }
    if (start) {
        broker.start();
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:39,代码来源:BrokerFactoryBean.java


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