Deploy Spring Boot Application for AWS Beanstalk

What would be the best way to deploy a Spring boot project, preferred only by jar, to AWS Beanstalk. Or should I just convert it to WAR and deploy it that way?


Decision:

I basically did this:

  • Created a new class to tell Spring Download that my application is a web application and that I need to create all the necessary configs:

    public class MyBootWebApp extends SpringBootServletInitializer { 
    
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return
    

    application.sources (MyBootApp.class); }}

(2) inside the .pom file changed the packaging to war as follows: <packaging>war</packaging>

That's all.

+4
source share
4 answers

Spring Boot to Beanstalk - Spring Guide WAR . Beanstalk Tomcat WAR . AWS .

EDIT: ,

1:

public class MyBootWebApp extends SpringBootServletInitializer {
    @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(MyBootApp.class);
    }
}

2. pom.xml <packaging>war</packaging>

+3

Spring Boot jar Elastic Beanstalk. , Spring. ,

EB CLI, Spring

eb init

2) java

.elasticbeanstalk/config.yml

deploy:
     artifact: target/spring-boot-aws-example-0.0.1-SNAPSHOT.jar

( jar )

5000, application.properties

server.port=5000

do

# Prerequisite : generate deployment artifact
mvn clean install

# Create a load balancing, auto-scaling environment
eb create

: https://exampledriven.wordpress.com/2017/01/09/spring-boot-aws-elastic-beanstalk-example/

+2

Beanstalk, , Java WAR. WAR ( -Beanstalk) (, gs guide).

+1

Spring Boot AWS Beanstalk, JAR:

  1. maven pom.xml ""
  2. AWS Beanstalk →
  3. → -
  4. - → "" "Java" ( Tomcat, JAR, tomcat, AWS Beanstalk -, Linux, JVM , . war, tomcat)
  5. Java 'jar' ( .zip/.war)
+1

Source: https://habr.com/ru/post/1533415/


All Articles