本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}