Spring Boot also provides the option of building a traditional WAR file instead of using a JAR.
First, we need to change our packaging in pom.xml to WAR:
<packaging>war</packaging>
We would want to prevent tomcat server to be embedded as a dependency in the WAR file. ;We can do this by modifying ;the dependency on the ;embedded server (Tomcat in the following example) to have a scope of provided. The following snippet shows the exact details:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
When you build the WAR file, Tomcat dependencies are not included. We can use this WAR to deploy on an application server, such as WebSphere or Weblogic, or a web server, such as Tomcat.