将Spring Boot项目(最好只是jar)部署到AWS Beanstalk环境的最佳方法是什么。或者我应该将它转换为WAR并以这种方式部署?
What would be the best way to deploy Spring Boot project, preferable just jar, to AWS Beanstalk environment. Or should I just convert it to WAR and deploy it that way?
解决方案:
基本上我做的是:
创建新类告诉Spring Boot我的应用是一个Web应用程序,我需要创建所有必要的配置:
Created new class to tell Spring Boot that my app is a web app and that I need to create all necessary configs: public class MyBootWebApp extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return
application.sources(MyBootApp.class); } }
application.sources(MyBootApp.class); } }
(2)里面。 pom文件将包装更改为像这样的战争:< packaging> war< / packaging>
(2) inside .pom file changed packaging to war like this: <packaging>war</packaging>
就是这样。
推荐答案将Spring Boot部署到Beanstalk的最简单方法是使用 Spring Guide 。然后,您只需设置Beanstalk应用程序以使用Tomcat并拖放WAR文件。 AWS负责其余部分。
Easiest way to deploy Spring Boot to Beanstalk is to use the Spring Guide for converting your project to a WAR file. Then you just setup your Beanstalk application to use Tomcat and drag and drop the WAR file. AWS takes care of the rest.
编辑:基于马克西姆所做的事情
EDIT: Based on what Maksim did
步骤1:
public class MyBootWebApp extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(MyBootApp.class); } }第2步:更改你的pom.xml使用< packaging> war< / packaging>
Step 2: Change your pom.xml use <packaging>war</packaging>
更多推荐
将Spring Boot应用程序部署到AWS Beanstalk
发布评论