`

web.xml 配置中classpath: 与classpath*:的区别

 
阅读更多

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

解释classes含义:
1.存放各种资源配置文件 eg.init.properties log4j.properties struts.xml
2.存放模板文件 eg.actionerror.ftl
3.存放class文件 对应的是项目开发时的src目录编译文件
总结:这是一个定位资源的入口

如果你知道开发过程中有这么一句话:惯例大于配置 那么也许你会改变你的想法

对于第二个问题
这个涉及的是lib和classes下文件访问优先级的问题: lib>classes
对于性能的影响应该不在这个范畴

classpath 和 classpath* 区别:

classpath:只会到你的class路径中查找找文件;
classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找.

分享到:
评论

相关推荐

    web.xml中如何设置配置文件的加载路径实例详解

    web应用程序通过Tomcat等容器启动时,会首先加载web.xml文件,通常我们工程中的各种配置文件,如日志、数据库、spring的文件等都在此时被加载,下面是两种常用的配置文件加载路径,即配置文件可以放到 SRC目录下或者...

    ssh框架在application.xml中配置数据源所需jar

    - dataAccessContext-local/jta.xml (see web.xml's "contextConfigLocation"). --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...

    企业人力资源管理项目SSH+EXT+MySQL+MD5

    在web.xml的display-name标签与welcome-file-list标签中加入一下代码 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* org.springframework.web.context....

    asm5.0.jar

    Error creating bean with name 'sqlSessionFactory' defined in URL [file:/E:/cloudwave-core/src/main/webapp/WEB- INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception ...

    负载均衡软件

    软件负载均衡, 为没有部署硬件负载均衡器的应用提供负载均衡功能;已打包成war文件; 1. 系统提供完整的日志信息(log4j.properties); 2. 系统提供节点连通性检查开关和...5. web.xml配置文件位置在/WEB-INF/web.xml

    ehcahe页面缓存详细内容

    2.将ehcache.xml放入能加载到classpath中的任意包中,不能放入WEB-INF中(其详细配置参数代表含义已经注释) 3.在工程中web.xml配置过滤器 <filter-name>SimplePageCachingFilter <filter-class>...

    maven相关资料

    ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:/*.xml"); 二、ClassPathXmlApplicationContext[只能读放在web-info/classes目录下的配置文件]和FileSystemXmlApplicationContext的区别 ...

    基于java的企业级应用开发:Spring的核心容器.ppt

    通常会使用ContextLoaderListener来实现,此种方式只需要在web.xml中添加如下代码: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:spring/applicationContext.xml ...

    基于java的企业级应用开发:Spring MVC的核心类和注解.ppt

    在使用时,只需将其配置在项目的web.xml文件中,其配置代码如下: <servlet> <servlet-name>springmvc</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> ...

    springweb3.0MVC注解(附实例)

    web.xml 中定义了一个名为 annomvc 的 Spring MVC 模块,按照 Spring MVC 的契约,需要在 WEB-INF/annomvc-servlet.xml 配置文件中定义 Spring MVC 模块的具体配置。annomvc-servlet.xml 的配置内容如下所示: <?xml...

    SSH第7章上机.zip ACCP8.0

    在web.xml中配置struts <filter-name>struts2 <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter <filter-name>struts2 <url-pattern>/* 在web.xml配置spring <!-- ...

    Struts2+Spring3+MyBatis3完整实例

    网上的东西好大多都不能直接用,自己结合网上资料做了一个Struts2+Spring3+MyBatis3的测试工程,JUnit测试用例和WEB服务。...- Find registry server-registry.xml at classpath resource - Server startup in 5329 ms

    Tomcat及其插件apache-tomcat-5.5.26-admin.zip的安装

    解压Administration Web Application,假设目录为F:\ apache-tomcat-5.5.25 把F:\ apache-tomcat-5.5.25 \server\webapps下面的admin文件夹copy到D:\apache-tomcat-5.5.25\server\webapps下面; 把F:\ apache-...

    DOS命令使用方法(超全).

    <param-value>classpath*:applicationContext-*.xml <!-- 这是spring 监听 --> <listener-class>org.springframework.web.context.ContextLoaderListener <!-- 利用spring监听 编码设置 --> ...

    Spring-Reference_zh_CN(Spring中文参考手册)

    12.5.1. iBATIS 1.x和2.x的概览与区别 12.5.2. iBATIS SQL Maps 1.x 12.5.2.1. 创建SqlMap 12.5.2.2. 使用 SqlMapTemplate 和 SqlMapDaoSupport 12.5.3. iBATIS SQL Maps 2.x 12.5.3.1. 创建SqlMapClient 12.5.3.2....

    生活轨迹SSH服务端

    -- <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value> --> <param-value>classpath:beans.xml <filter-name>struts2 <filter-class>org.apache.struts2...

    让Struts2可以从classpath及jar中查找jsp文件

    1、把两个类文件加入你的工程或者打包成jar。...4、注意:这个ResultType会在你的WEB-INF下面建立一个名为CLASSPATH-PAGES的文件夹,并将找到的jsp释放到这里。你可以改写这个类,从而在某个地方配置这一路径。

    客户关系管理系统框架搭建(二)

    <value>classpath:hibernate.cfg.xml <!--4 创建事务管理器 aop切面--> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> ...

    Spring MVC Demo

    <param-value>classpath:applicationContext-*.xml <!--查找这里可以配置多个,用逗号分割或者用通配符*也就是第二行 <param-value>/WEB-INF/mvc.xml,/WEB-INF/mvc1.xml <param-value>/WEB-INF/mvc*.xml ...

    spring-simple-web:使用 Spring Framework 的简单 Web (WAR) 项目

    这个简单的例子演示了在 web 应用程序中使用的 Spring 容器,即org.springframework.web.context.WebApplicationContext Web 应用程序使用 Spring Web 侦听器初始化,例如web.xml org.springframework.web.context...

Global site tag (gtag.js) - Google Analytics