将Spring Boot应用程序部署到AWS Beanstalk

编程入门 行业动态 更新时间:2024-10-11 11:19:51
本文介绍了将Spring Boot应用程序部署到AWS Beanstalk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

将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

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

    发布评论

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

    >www.elefans.com

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