打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Change dependencies during deployment

J2EE SPEC specifies that every resource referenced by an application must be listed in web.xml file. The purpose of this regulation is to declare and externalize the dependencies of the application and make it is possible to change these dependencies during deployment without any code change.

 

However, changing dependencies this way may need some effort. Usually, web applications are packaged as .war files. Changing web.xml file inside a war file means repackaging the .war file.

 

Tomcat comes up with a better way to do the same thing - change dependencies without touching web.xml. The .war file remains intact.

 

Configuration element <context> can include <Environment>, <Resource>, <ResourceLink> and <Transaction> sub elements to re-define/define the values of the dependencies of the application deployed at this context.

These values defined in tomcat <context> element can override the corresponding values (with same names) defined in web.xml.

 

If the application doesn‘t list its dependencies using <env-entry>, <resource-ref> or <resource-env-ref> in web.xml (this is bad practice), it can also be deployed and run as long as the needed resources have been defined in context using above elements.

 

PS, if you want to use a global resource defined in server.xml, you should use <ResourceLink> instead of <Resource> in <Context>.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
在Maven使用Tomcat插件配置context.xml连接JDBC数据源的方法
tomcat下使用jax-ws的RI环境
指向tomcat
tomcat server.xml的配置
A Technical Introduction to XML
What is the Document Object Model?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服