How to run Spring Boot application on Tomcat
- Change to war packaging in pom.xml:
<packaging>war
- Application Main class to extend SpringBootServletInitializer.
- Override configure method in this class.
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {return application.sources(Application.class);}
- Add Tomcat-starter dependency in pom.xml.
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId><scope>provided</scope></dependency>
- Run maven install, war will generate in target folder.
- Deploy on standalone Tomcat Server.
- Don't forget to add context root to access the services.
I will be happy to help if you run into some issues, while following above steps. Do drop the comments in the comment section.
<<<<<<<<<<<<<<<<< Happy Coding >>>>>>>>>>>>>>>>>
Comments
Post a Comment