Web服务作为JAR文件,还是WAR在另一个WAR中? [英] Web service as a JAR file, or WAR inside another WAR?

查看:126
本文介绍了Web服务作为JAR文件,还是WAR在另一个WAR中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Tomcat 6上运行的SOAP Web服务(使用Spring Web Services,Java)

I have a SOAP web service running on Tomcat 6 (using Spring Web Services, Java)

现在我想将这个web服务合并到另一个大型Web应用程序中(使用Spring,Java而不是Web服务)并使用Web服务作为主Web应用程序的有点插件。我的意思是当我运行我的主应用程序时,我的Web服务也将开始运行。他们将使用相同的资源。

Now I want to merge this webservice into another big web application (uses Spring, Java and not a web service) and use the web service as kinda plugin for the main web app. I mean when I run my main app my web service will also start to run. And they will use the same resources.

主Web应用程序已经有几个插件,它们是WEB-INF / LIB文件夹中的JAR文件。但我的Web服务是WAR文件,所以我可以在其他Web应用程序WEB-INF / LIB文件夹中使用Web应用程序(WAR文件)吗?

The main web app already has several plugins which are JAR files in its WEB-INF/LIB folder. But my web service is a WAR file so can I use a web application (WAR file) inside another web applications WEB-INF/LIB folder?

如果我不能做那是可以删除我的Web服务的WEB-INF文件夹和使我的Web服务成为JAR文件并将其放在我的主应用程序WEB-INf / LIB文件夹下?我不确定我是否可以将Web服务作为JAR文件提供。

If I can not do that is that possible to remove the WEB-INF folder of my web service and make my web service a JAR file and put it under my main apps WEB-INf/LIB folder? I am not sure that I can serve a web service as a JAR file.

您认为哪种方法更好或者您有其他建议吗?

Which approach do you think is better or do you have other suggestions?

谢谢

推荐答案

我建议您从网络服务中制作一个JAR并放入在lib文件夹中。关于java的好处是,只要你正确加载它,你的代码所在的位置并不重要。

I would recommend that you make a JAR out of your webservice and put that in the lib folder. The good thing about java is that it doesn't matter where your code is located as long as you load it right.

我认为你不能在WAR内部使用WAR。但是,您可以将两个WAR项目合并为一个(例如,可以通过maven构建系统执行)。仍然,合并WAR是一种复制 - 粘贴 - 覆盖操作,这使得很多人不愿意这样做。

I don't think you can have WAR inside WAR. You can however merge two WAR projects into one (which can be performed e.g., by the maven build system). Still, merging WARs is a copy-paste-overwrite operation which leaves alot to desire.

这篇关于Web服务作为JAR文件,还是WAR在另一个WAR中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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