Using Gradle:
dependencies {
Compile ("Org.springframework.boot:spring-boot-starter-web")
Providedcompile ("Org.springframework.boot:spring-boot-starter-tomcat")//use providedcompile here, The resulting jar package can be placed inside Tomcat to run
compile ("Org.springframework.boot:spring-boot-starter-tomcat")//But run Application.main will error. So use Providedcompile when packaging for war
......
Testcompile group: ' JUnit ', Name: ' JUnit ', Version: ' 4.11 '
}
Focus on the use of Providedcompile
Using maven:
<dependency>< Span class= "PLN" > <groupid>org.springframework.boot& Lt;/groupid> <artifactid></artifactid> <scope >provided</scope> </ Dependency>
Focus is <scope>provided</scope>
Reference:
Spring Boot Reference Guide
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
Spring Boot Tomcat Container Deployment errors-stack Overflow
Http://stackoverflow.com/questions/27361662/spring-boot-tomcat-container-deployment-errors
Quickly build apps with spring boot
Http://www.infoq.com/cn/news/2014/01/spring-boot
Detailed content to be edited
Spring boot packaged as a method for deploying war files that can be run under Tomcat (using Gradle, Intellij idea)