/ WEB-INF / classes vs / WEB-INF / lib [英] /WEB-INF/classes vs /WEB-INF/lib
问题描述
我想将我的 Java EE6
Web类(bean,过滤器,servlet)打包到jar中并将其放入 / WEB-INF / lib /
目录以及其他实用程序jar并完全放弃 / WEB-INF / classes /
目录。
I'd like to package my Java EE6
web classes (beans, filters, servlets) into jar and place it into /WEB-INF/lib/
directory along with other utility jars and abandon /WEB-INF/classes/
directory totally.
在类加载,访问应用程序上下文等方面两者之间是否存在实质性差异?
Are there any substantial differences between the two in terms of classloading, acessing application context, etc?
谢谢。
PS:每当谷歌搜索任何java规范时,我总是被重定向到Oracle文档索引,这是远离原始URL的十几次点击。有谁知道那里发生了什么?
PS: Whenever googling any of java specs I'm always redirected to Oracle documentation index which is dozen clicks away from original url. Anyone knows what's happening there?
推荐答案
我要去 / WEB-INF / classes
。它允许您在调试模式下运行应用程序,在更改时运行热交换类。如果您将所有内容打包为jar,则每次更改类时都必须重新打包并重新部署应用程序。
I'd go for /WEB-INF/classes
. It allows you to run your application in debug mode and hot-swap classes on change. If you package everything as a jar, you'd have to repackage and redeploy the app every time you change a class.
这篇关于/ WEB-INF / classes vs / WEB-INF / lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!