java 使用 Spring Tool Suite 部署 Spring Web 应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12444096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 08:54:15  来源:igfitidea点击:

Deploying spring web apps using Spring Tool Suite

javaspringweb-applications

提问by prosseek

I'm new to Java web framework, I googled to find that spring is one of the most popular framework. I tried to install tools and searched a tutorial to run spring framework on my mac.

我是 Java Web 框架的新手,我用谷歌搜索发现 spring 是最受欢迎的框架之一。我尝试安装工具并搜索教程以在我的 mac 上运行 spring 框架。

step 1 - Tomcat installation

第 1 步 - Tomcat 安装

Following this site, I could install Tomcat on my mac. I'm using :8080 port for Tomcat.

这个站点之后,我可以在我的 mac 上安装 Tomcat。我正在为 Tomcat 使用 :8080 端口。

step 2 - spring tool suite installation

第 2 步 - spring 工具套件安装

From this site, I could install Spring Tool Suite.

这个站点,我可以安装 Spring Tool Suite。

step 3 - making an example following tutorial

第 3 步 - 按照教程制作示例

I found a tutorialon using Spring Tool Suite. Following the procedure, I could build manolitomvc app.

找到了一个关于使用 Spring Tool Suite的教程。按照这个程序,我可以构建 manolitomvc 应用程序。

enter image description here

在此处输入图片说明

step 4.1 - deployment <-- issue 1

步骤 4.1 - 部署 <-- 问题 1

Finally, I'd like to access the web app at http://localhost:8080/manolitomvc.

最后,我想访问 Web 应用程序http://localhost:8080/manolitomvc

I clicked the green arrow to see the error message.

我单击了绿色箭头以查看错误消息。

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明

step 4.2 - deployment <-- issue 2

步骤 4.2 - 部署 <-- 问题 2

I opened overview page, and I guessed that I could set server location and deploy path to make spring web app available.

我打开了概览页面,我猜我可以设置服务器位置和部署路径来使 Spring Web 应用程序可用。

However, I have no idea how to set the server location (Tomcat server location that I installed in step1).

但是,我不知道如何设置服务器位置(我在步骤 1 中安装的 Tomcat 服务器位置)。

enter image description here

在此处输入图片说明

I tried to copy the manolitomvc directory into Tomcat main document directory(/Library/Tomcat/webapps), but it doesn't work.

我试图将 manolitomvc 目录复制到 Tomcat 主文档目录 ( /Library/Tomcat/webapps) 中,但它不起作用。

How can I deploy the web app so that I can access the spring web app at http://localhost:8080/manolitomvc?

如何部署 Web 应用程序以便我可以在 访问 spring Web 应用程序http://localhost:8080/manolitomvc

Could you recommend any other practical tutorial that I can follow to setup and use spring framework?

你能推荐我可以遵循的任何其他实用教程来设置和使用 spring 框架吗?

采纳答案by Ralph

Try not to use "VMware TC" try to start with a "normal" Tomcat.

尽量不要使用“VMware TC”尝试从“普通”Tomcat 开始。

  • Open the Context Menu in the "Servers" tab: New/Server
  • Select Apache/Tomcat v? -> Next
  • Select The Tomcat Intallation Directory, or click on "Download and Install.."
  • 在“服务器”选项卡中打开上下文菜单:新建/服务器
  • 选择 Apache/Tomcat v? -> 下一步
  • 选择 Tomcat 安装目录,或点击“下载并安装..”

回答by prosseek

Thanks to Ralph's help, I could make Tomcat server working Spring Tool Suite.

感谢 Ralph 的帮助,我可以让 Tomcat 服务器运行 Spring Tool Suite。

Step1. Stop the tomcat server

步骤1。停止tomcat服务器

cd /Library/Tomcat/binand execute sudo sh shutdown.sh.

cd /Library/Tomcat/bin并执行sudo sh shutdown.sh

Step2. Create server

第2步。创建服务器

From Servers, New > Other ...

从服务器,新建 > 其他 ...

enter image description here

在此处输入图片说明

Select server/Server

选择服务器/服务器

enter image description here

在此处输入图片说明

Select Apache/Tomcat

选择 Apache/Tomcat

enter image description here

在此处输入图片说明

Select web application

选择网络应用

enter image description here

在此处输入图片说明

Step3. Execution and test

第三步。执行和测试

Execute the server

执行服务器

enter image description here

在此处输入图片说明

You can access the app through localhost:8080/manolitomvc.

您可以通过 访问该应用程序localhost:8080/manolitomvc

enter image description here

在此处输入图片说明