工作小总结

classpath和classpath*的区别及classpath到底是什么

概念解释及使用场景:classpath是指WEB-INF文件夹下的classes目录。通常我们一般使用这种写法实在web.xml中,比如spring加载bean的上下文时,如下:<!--系统自动加载文件--><!--这里使用的是classpath*:的形式--><context-param> <param-na

概念解释及使用场景:

classpath是指WEB-INF文件夹下的classes目录。

通常我们一般使用这种写法实在web.xml中,比如spring加载bean的上下文时,如下:

复制代码

<!--系统自动加载文件--><!--这里使用的是classpath*:的形式--><context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:/spring-context-*.xml</param-value></context-param><!--配置spring的context监听器  --><listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>

复制代码

经过如上的写法,可能会认为这个就是web.xml固有的写法,其实不是,这种写法是spring的写法,与web.xml无关。可以通过spring

原创不易,完成人机校验,阅读全文

相关推荐