I have created spring boot web application, but I am unable to deploy spring boot web application WAR file on tomcat and I am able to run it as java application. How to run
Here are two good documentations on how to deploy the Spring Boot App as a war file.
You can follow this spring boot howto-traditional-deployment documentation -
Steps according to this documentation -
You update your application’s main class to extend SpringBootServletInitializer.
The next step is to update your build configuration so that your project produces a war file rather than a jar file.
Mark the embedded servlet container dependency as provided.
org.springframework.boot
spring-boot-starter-tomcat
provided
and one more way -
See this spring io documentation which outlines how to deploy the spring boot app to an application server.
Steps -
Change jar packaging to war.
Comment out the declaration of the spring-boot-maven-plugin plugin in your pom.xml
Add a web entry point into your application by extending SpringBootServletInitializer and override the configure method
Remove the spring-boot-starter-tomcat dependency and modfiy your spring-boot-starter-web dependency to
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat
In your pom.xml, remove spring-beans and spring-webmvc dependencies. The spring-boot-starter-web dependency will include those dependecies.