Publish the Springboot project to a standalone Tomcat run

Source: Internet
Author: User

In the development phase we recommend the use of inline tomcat for development, because this is much easier, but to build the environment, I want to run in a standalone Tomcat container because we need to do additional optimizations for Tomcat, and then we need to package the project into a war package for publishing.

1.1. The project is packaged in the form of war

1.2. Set the range of Spring-boot-starter-tomcat to provided

Set to provided will exclude the package when it is packaged, because it is not required to be run in a standalone tomcat.

1 <dependency>23         <groupId>org.springframework.boot</groupId> 4 5         <artifactId>spring-boot-starter-tomcat</artifactId>67         <scope>provided </scope>89       </dependency>
1.3. Modify the code to set the startup configuration

You need to integrate the Springbootservletinitializer and then rewrite the Configure to set the Spring boot entry class in.

1.4. Fight a war bag

Package success:

1.5. Deploy to Tomcat

Unzip the apache-tomcat-7.0.57.tar.gz, unzip the war packet to the root directory under WebApps, and start:

Perfect!

Publish the Springboot project to a standalone Tomcat run

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.