如何在Windows Server 2012 R2上部署Spring Boot应用程序?

编程入门 行业动态 更新时间:2024-10-11 21:30:24
本文介绍了如何在Windows Server 2012 R2上部署Spring Boot应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个或多或少已经完成的Springboot应用程序,并且可以在本地主机上顺利运行.

I have a Springboot application that I've more or less completed and is running smoothly on my local host.

我还有一个现在可以开始使用的Windows服务器.我发现,当我用浏览器的IP地址访问该服务器时,它会在以下位置显示Windows IIS的"Hello World"页面:

I also have a Windows server that I can now begin to play with. I've figured out that when I hit this server with its IP address in my browser it shows a Hello World page from Windows IIS at this location:

C:\inetpub\wwwroot\iisstart.html

我可以简单地将当前springboot应用程序的全部内容复制并粘贴到此文件夹中,并期望它能正常工作吗?我可以复制和粘贴JAR文件吗?关于如何将应用程序部署到服务器,以便其他用户可以访问它,我一直找不到明确的答案.我该怎么办?

Can I simply copy and paste the entire contents of my current springboot application into this folder and expect it to work? Can I copy and paste a JAR file? I have been unable to find a clear answer as to how to deploy my application to my server so that other users can access it. What should I do?

推荐答案

Spring Boot首先使用以下插件配置使用Maven创建一个完全可执行"的jar:

Spring Boot first create a ‘fully executable’ jar with Maven use the following plugin configuration:

<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> </configuration> </plugin>

使用Gradle

springBoot { executable = true }

转到应用程序目录(您必须在系统中安装Web应用程序的位置)

Go to application directory (Where you have to install web app in system )

粘贴Spring boot捆绑jar(使用 mvn软件包构建)

Paste Spring boot bundled jar (build using mvn package)

通过命令提示符转到当前路径,然后键入 java -jar ... jarName.jar .(例如java -jar custstomerService.jar)

Go to current path via command prompt and just type java -jar ...jarName.jar.(eg. java -jar custstomerService.jar)

注意:

运行完全可执行的jar时,它将jar的目录用作工作目录.

When a fully executable jar is run, it uses the jar’s directory as the working directory.

这仅适用于带有捆绑的Web服务器jar部署的春季启动,不适用于战争

This is only for spring boot with bundled web server jar deployment not for war

更多详细信息

更多推荐

如何在Windows Server 2012 R2上部署Spring Boot应用程序?

本文发布于:2023-10-28 10:56:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536437.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   如何在   Server   Windows   Spring

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!