当前位置: 代码迷 >> Java Web开发 >> 加入web配置文件!该如何处理
  详细解决方案

加入web配置文件!该如何处理

热度:210   发布时间:2016-04-17 00:31:17.0
加入web配置文件!
我创建了一个Java web工程。
在src中有一个配置文件datasource.xml
我想把它加入到web.xml中,应该怎么写路径呀?
web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
datasource.xml
</param-value>
</context-param>

------解决方案--------------------
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:datasource.xml</param-value>
</context-param>
------解决方案--------------------
探讨
这个classpath是个什么东东,可以解释下吗?

------解决方案--------------------
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext*.xml,classpath*:applicationContext*.xml
</param-value>
</context-param>
  相关解决方案