1 启动类修改
@SpringBootApplication
public class Application extends SpringBootServletInitializer{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(YiyongApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(YiyongApplication.class, args);
}
}
2 配置biuld节点
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- 修改代码后自动生效,Reload Java classes without restarting the container -->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.6.RELEASE</version>
</dependency>
</dependencies>
</plugin>
<!-- web.xml is missing and <failOnMissingWebXml> is set to true pom.xml /test-browser-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<mainClass>com.test.testServiceApplication</mainClass>
</configuration>
</plugin>
</plugins>
<finalName>demoTest</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
</build>
3 添加tomcat依赖
<!--因配置外部TOMCAT 而配置-->
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency> -->
4 maven install ,查看target目录