當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。