如何使用jetty嵌入spring mvc应用程序
我有一个正在运行的 Spring MVC 应用程序(在部署到 jboss 时执行我想要的所有操作),现在我正在寻找一种如何从 jar 启动我的应用程序的方法。我的想法是,在启动 jar 时,首先应该启动某种 Web 服务器以便能够运行该应用程序。
我尝试了很多与jetty的组合(已经损失了大约2天),但每一个都失败了,大部分建议来自https://stackoverflow.com/tags/embedded-jetty/hot
我的主要弱点是我对 servlet、上下文等没有真正透彻的了解。我在浏览谷歌搜索时经常看到的术语,也许我已经找到了解决方案,但不理解它。
有人做过类似的事情吗?是的,我对 tomcat 提出了类似的问题:
I have a working Spring MVC application(doing everything I wanted when deployed to jboss) and now I'm looking a way how to start my application from a jar. What I've though of is when starting jar, first some kind of web server should be started in order to be able to run the application.
And I've tried like a tons of combinations with jetty(lost about 2 days already), and I failed every one of them, mostly suggestions from https://stackoverflow.com/tags/embedded-jetty/hot
My main weakness is that I don't really have thorough understanding of servlets, contexts and so on. Terms which I see on a regular basis while browsing google search, maybe I found a solution already but didn't understand it.
Has anyone done something similar? And yes I've asked similar question for tomcat :
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我已经做过好几次这样的事情了,如果你知道这些位是如何工作的,那就相当简单了。
既然您已经解释过您不知道这些位是如何工作的,那么这会有点困难
:)
但它们并不太难学,而且最简单的学习方法就是实践 - 所以你正在走上正确的道路。
这里接受的答案:可执行的war文件,在没有maven的情况下启动jetty 是您将获得的有关此主题的一些最佳建议。
我建议:
如果您遇到任何问题,请提出具体问题并提供问题的具体示例,我们将尽力提供帮助。
Yes, I've done this sort of this several times, and it's fairly straight forward if you know how the bits work.
Since you've explained that you don't know how the bits work, that's going to be a bit harder
:)
But they're not too hard to learn, and the easiest way to learn is by doing - so you're heading down the right path.
The accepted answer here: Executable war file that starts jetty without maven is some of the best advice you're going to get on this topic.
I would suggest:
If you run into any issues, ask specific questions with specific examples of what went wrong, and we'll try and help out.