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


Java ConfigurableWebApplicationContext.setConfigLocations方法代码示例

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


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

示例1: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext servletContext,
        ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);
    String policy = servletContext.getInitParameter("superfly-policy");
    if (policy == null) {
        policy = Policy.NONE.getIdentifier();
    }
    String disableHotp = servletContext.getInitParameter("disable-hotp");
    if ("true".equals(disableHotp)) {
        policy = Policy.NONE.getIdentifier();
    }
    String[] oldLocations = applicationContext.getConfigLocations();
    String[] newLocations = new String[oldLocations.length];
    for (int i = 0; i < oldLocations.length; i++) {
        newLocations[i] = oldLocations[i].replaceAll("\\!policy\\!", policy);
    }
    applicationContext.setConfigLocations(newLocations);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:20,代码来源:CustomContextLoaderListener.java

示例2: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
protected void customizeContext(ServletContext servletContext,
		ConfigurableWebApplicationContext applicationContext) {
	String[] configLocations = applicationContext.getConfigLocations();
	String[] jresConfigLocations = null;
	if (configLocations == null || configLocations.length < 1) {
		configLocations = StringUtils.tokenizeToStringArray(
				servletContext.getInitParameter(CONFIG_LOCATION_PARAM),
				",; \t\n");
	}
	if (configLocations != null) {
		jresConfigLocations = new String[configLocations.length + 2];
		jresConfigLocations[0] = "classpath:conf/spring/jres-web-beans.xml";
		jresConfigLocations[1] = "classpath:conf/spring/jres-common-beans.xml";
		int index = 2;
		for (String config : configLocations) {
			jresConfigLocations[index] = config;
			index++;
		}

	}
	applicationContext.setConfigLocations(jresConfigLocations);
	super.customizeContext(servletContext, applicationContext);
}
 
开发者ID:xiyelife,项目名称:jresplus,代码行数:24,代码来源:ContextLoaderListener.java

示例3: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(final ServletContext servletContext, final ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);

    final String[] newLocations = cloudStackContext.getConfigLocationsForWeb(configuredParentName, applicationContext.getConfigLocations());

    applicationContext.setConfigLocations(newLocations);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:9,代码来源:CloudStackContextLoaderListener.java

示例4: createWebApplicationContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
/**
 * Instantiate the WebApplicationContext for the ActionServlet, either a default
 * XmlWebApplicationContext or a custom context class if set.
 * <p>This implementation expects custom contexts to implement ConfigurableWebApplicationContext.
 * Can be overridden in subclasses.
 * @throws org.springframework.beans.BeansException if the context couldn't be initialized
 * @see #setContextClass
 * @see org.springframework.web.context.support.XmlWebApplicationContext
 */
protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent)
		throws BeansException {

	if (logger.isDebugEnabled()) {
		logger.debug("ContextLoaderPlugIn for Struts ActionServlet '" + getServletName() +
				"', module '" + getModulePrefix() + "' will try to create custom WebApplicationContext " +
				"context of class '" + getContextClass().getName() + "', using parent context [" + parent + "]");
	}
	if (!ConfigurableWebApplicationContext.class.isAssignableFrom(getContextClass())) {
		throw new ApplicationContextException(
				"Fatal initialization error in ContextLoaderPlugIn for Struts ActionServlet '" + getServletName() +
				"', module '" + getModulePrefix() + "': custom WebApplicationContext class [" +
				getContextClass().getName() + "] is not of type ConfigurableWebApplicationContext");
	}

	ConfigurableWebApplicationContext wac =
			(ConfigurableWebApplicationContext) BeanUtils.instantiateClass(getContextClass());
	wac.setParent(parent);
	wac.setServletContext(getServletContext());
	wac.setNamespace(getNamespace());
	if (getContextConfigLocation() != null) {
		wac.setConfigLocations(
			StringUtils.tokenizeToStringArray(
						getContextConfigLocation(), ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS));
	}
	wac.addBeanFactoryPostProcessor(
			new BeanFactoryPostProcessor() {
				public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
					beanFactory.addBeanPostProcessor(new ActionServletAwareProcessor(getActionServlet()));
					beanFactory.ignoreDependencyType(ActionServlet.class);
				}
			}
	);

	wac.refresh();
	return wac;
}
 
开发者ID:Gert-Jan1966,项目名称:spring-struts-forwardport,代码行数:47,代码来源:ContextLoaderPlugIn.java

示例5: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext sc, ConfigurableWebApplicationContext wac) {
    if(sc.getInitParameter(ContextLoader.CONFIG_LOCATION_PARAM)==null){
        wac.setConfigLocations(new String[]{"/WEB-INF/wmix.xml","classpath*:META-INF/solmix/solmix.xml"});
    }
    super.customizeContext(sc, wac);
}
 
开发者ID:solmix,项目名称:wmix,代码行数:8,代码来源:WmixContextLoaderListener.java

示例6: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);

    if ( applicationContext.getParent() != null ) {
        /* Only set resource locations if a parent exists */
        String[] newLocations = clouCattleContext.getConfigLocationsForWeb(configuredParentName, 
                applicationContext.getConfigLocations());

        applicationContext.setConfigLocations(newLocations);
    }
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:13,代码来源:CloudStackContextLoaderListener.java

示例7: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);

    if ( applicationContext.getParent() != null ) {
        /* Only set resource locations if a parent exists */
        String[] newLocations = cloudStackContext.getConfigLocationsForWeb(configuredParentName, 
                applicationContext.getConfigLocations());

        applicationContext.setConfigLocations(newLocations);
    }
}
 
开发者ID:ibuildthecloud,项目名称:dstack,代码行数:13,代码来源:CloudStackContextLoaderListener.java

示例8: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);

    String[] newLocations = cloudStackContext.getConfigLocationsForWeb(configuredParentName, applicationContext.getConfigLocations());

    applicationContext.setConfigLocations(newLocations);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:9,代码来源:CloudStackContextLoaderListener.java

示例9: customizeContext

import org.springframework.web.context.ConfigurableWebApplicationContext; //导入方法依赖的package包/类
@Override
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
    super.customizeContext(servletContext, applicationContext);
    
    String[] newLocations = cloudStackContext.getConfigLocationsForWeb(configuredParentName, 
            applicationContext.getConfigLocations());
    
    applicationContext.setConfigLocations(newLocations);
}
 
开发者ID:ibuildthecloud,项目名称:cloudstack-modules,代码行数:10,代码来源:CloudStackContextLoaderListener.java


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