How To Run Spring Boot Web Application On External Tomcat

How To Run Spring Boot Web Application On External Tomcat.





By default Spring Boot Web Application is ready for Production/Deployable and runs on Embedded Tomcat Server. If you want to run it on External Tomcat Server Instance, you first need to configure it.

In previous post we learned how to create simple hello world spring boot web application. we used our previous spring boot web application in this example.

In Development Environment External Tomcat is very handy. So lets start to configure it in Intellij. 

Before start anything you just run bootWar Gradle task. It will generate a war file of our project at build/libs/springbootdemo1.war 

Note: For simplify war file name remove the version in build.gradle
      file.


Create a war file using bootWar
We will use this war file as an Artifact in External Tomcat.


Now click on Edit Run/debug Configuration button and Add New Configuration by clicking on very top left most green plus sign button and select Local Tomcat Server.


Add New Tomcat Configuration in Intellij
Now setting up New Tomcat Instance or Application Server and Ports as shown below.


Configure Application Server in Intellij

Now in Deployment Tab click on green plus sign button to add an External Source. Select the previously generated war file to deploy on server startup. We can also define the context for web application but here we use default.

Now we need to add two gradle task in Before launch Section. Add clean and bootWar tasks as shown below.


Set War file as Artifact.

Now just run the application by clicking on green play button. 





Comments

Popular posts from this blog

Spring Boot v.2.0.2 Release Hello World Example

Basic CRUD Application Using Spring Boot REST Web Service with AngularJS