问题
Problem: I have two contextConfigLocation
parameters, one with @Configuration
classes for spring-social-facebook and one with xml-file for app:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>com.communicator.core.social.facebook.config</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/root-context.xml</param-value>
</context-param>
Both of them use one param-name
, and I don't know how to fix it.
回答1:
You will be try this
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/root-context.xml,
com.communicator.core.social.facebook.config
</param-value>
</context-param>
回答2:
You can use white space to separate each parameter within <param-value>
like this.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/resources/spring/*.xml /WEB-INF/resources/module/*.xml /WEB-INF/resources/function/*.xml /WEB-INF/resources/bean/*.xml</param-value>
</context-param>
回答3:
After test all answers, none works for me. I found the solution in this post JSF2 how to specify more than one custom element library in web.xml file
<param-value>com.communicator.core.social.facebook.config;/WEB-INF/root-context.xml</param-value>
回答4:
Servlet spec says that you can have only one value for any context parameter. So, you are left with going with delimited list only.
<context-param>
<param-name>Hosts</param-name>
<param-value>ex1.com,ex2.com,.....</param-value>
</context-param>
来源:https://stackoverflow.com/questions/16860016/how-to-put-two-param-values-in-one-context-param-in-spring