- Change packaging to war in Pom.xml and update project (Eclipse Project report red)
- Introducing Tomcat Dependency
<dependency> <groupId>org.springframework.boot</groupId> <artifactId> Spring-boot-starter-tomcat</artifactid> </dependency>
3. Modify the startup class to inherit Springbootservletinitializer
4. Rewrite the Configure method of the Startup class, and return Builder.sources (Xxx.class) in the method; XXX for own startup class
@SpringBootApplication Public classStartdemoapplicationextendsspringbootservletinitializer{@OverrideprotectedSpringapplicationbuilder Configure (Springapplicationbuilder builder) {//TODO auto-generated Method Stub returnBuilder.sources (startdemoapplication.class); Start class} Public Static voidMain (string[] args) {Springapplication.run (startdemoapplication.class, args); }}
5. Clean Project
6. Install Project
Springboot Learning-war Pack-Pack War