/WEB-INF/classes 与/WEB-INF/lib [英] /WEB-INF/classes vs /WEB-INF/lib

查看:37
本文介绍了/WEB-INF/classes 与/WEB-INF/lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的 Java EE6 Web 类(bean、过滤器、servlet)打包到 jar 中,并将其放入 /WEB-INF/lib/ 目录中与其他实用程序 jars 并完全放弃 /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 与/WEB-INF/lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆