2

I am currently in the project, that has multiple wars, with similar dependencies: Spring, Hibernate, Guava, e t.c. I am thinking of moving those dependencies to server lib folder for optimization:

Obvious downside of such approach

  1. This would increase complexity of the environment
  2. This would increase complexity of the dependencies management for the project.

There fore my questions:

  1. Is it worth doing? (Meaning will there be any benefits,from performance and memory, point of view? (Or it's just another headache))
  2. Are there any tools to make such transition smoother?
4

2 回答 2

2

我已经看到这是双向的。就个人而言,我更喜欢将依赖项打包在可交付成果中——WAR/EAR 本身就有 spring、hibernate 等 jar。否则,您需要一个完全不同的发布策略来管理部署到服务器的依赖项,如果您需要将不兼容版本的依赖项部署到同一服务,那么宇宙可能会可怜您。

不利的一面是,它可能会增加重复,因为这些资源可能存在于多个 web 应用程序中……但实际上,您部署应用程序的数量真的受到限制吗?

于 2013-08-01T05:02:32.667 回答
1

是的,将不同战争的通用 jar 放在 server/lib 目录中会更有效。但是随后它为您的安装程序引入了更多工作,以将这些 jar 复制到所需的文件夹。

注意事项

当所有不同的 Web 应用程序都使用相同版本的 jars 时,这种将公共 jars 放入 server/lib 的方法很有用。如果不同的 Web 应用程序需要不同版本的同一 jar,则避免将其放入服务器/lib 中。否则你会遇到引用错误类版本的问题,并且可能会出现其他错误。

于 2013-08-01T05:00:48.043 回答