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?
Solution:
Basically what I did was this:
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); } }
(2) inside .pom file changed packaging to war like this: <packaging>war</packaging>
That was it.
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
Step 1:
public class MyBootWebApp extends SpringBootServletInitializer {
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyBootApp.class);
}
}
Step 2: Change your pom.xml use <packaging>war</packaging>