再举一个例子:
请注意其中的注释,并注意我使用了,而不是如果我对我的“util”实现不满意,我可以在当前项目中覆盖类。我实际上不确定是否被视为“PostResource”或“PreResource”,但覆盖静态内容和类是有效的。PostResources
PreResources
JarResource
<!--
https://tomcat.apache.org/tomcat-8.0-doc/config/resources.html
http://stackoverflow.com/questions/23143697/adding-external-resources-to-class-path-in-tomcat-8
http://stackoverflow.com/questions/34515852/tomcat-7-application-migration-to-tomcat-8
http://mikusa.blogspot.co.za/2014/07/tips-on-migrating-to-tomat-8-resources.html
-->
<Context path="/MY_PROJECT" docBase="/MY_PROJECT">
<Resources className="org.apache.catalina.webresources.StandardRoot">
<!-- Post-load the static content from my util project -->
<PostResources className="org.apache.catalina.webresources.DirResourceSet"
base="/workspace/MY_UTIL_PROJECT/WebContent"
webAppMount="/">
</PostResources>
<!-- Post-load the classes from my util project -->
<PostResources className="org.apache.catalina.webresources.DirResourceSet"
base="/workspace/MY_UTIL_PROJECT/WebContent/WEB-INF/classes"
webAppMount="/WEB-INF/classes">
</PostResources>
<!-- Load the JARs contained within my util project -->
<JarResources className="org.apache.catalina.webresources.DirResourceSet"
base="/workspace/MY_UTIL_PROJECT/WebContent/WEB-INF/lib"
webAppMount="/WEB-INF/lib">
</JarResources>
</Resources>
</Context>