DEV Community

Salad Lam
Salad Lam

Posted on

Creates Spring Boot application runs in Java Servlet container

Notice

I wrote this article and was originally published on Qiita on 23 August 2022.


On Servlet 3.0 container

If you plan to run your project on Servlet 3.0 container (e.g. Apache Tomcat start from 7.0), it is very easy to convert the project from run in command line to run in a Servlet container.

  1. in software project management tool, change generate file format from jar to war, and prevent to append version number to file name
  2. include org.springframework.boot:spring-boot-starter-tomcat into project's dependency
  3. change the class which annotated with @SpringBootApplication, to extend org.springframework.boot.web.servlet.support.SpringBootServletInitializer

That's all!

Reference

  1. Deploy a Spring Boot WAR into a Tomcat Server

Top comments (0)