Springboot Learning-war Pack-Pack War

Source: Internet
Author: User

    1. Change packaging to war in Pom.xml and update project (Eclipse Project report red)
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.