I am trying to deploy a spring boot app into one EB worker tier but seems that EB it is not ready to manage this kind of project.
Have I to mandatory generate a .war from my spring boot app?
Thanks!
I have found the problem.
EB expects a .war file and Spring Boot app usually is launche by a embedded Tomcat or Jetty.
I have found the solution in this guide:
http://spring.io/guides/gs/convert-jar-to-war/
Summing up:
Add tomcat dependency with provided scope in pom.xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
Create a class extending SpringBootServletInitializer and load the entrypoint within this class. This way, we are indicating to the servlet container how to launch the app.
package com.proyecti.magma.conversionsworker.config.servlet; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import com.proyecti.magma.conversionsworker.entrypoint.Application; public class ServletConfig extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
来源:https://stackoverflow.com/questions/26103790/spring-boot-on-elastic-beanstalk-worker-tier