spring boot 定时程序发布WAR  

需要配置:

<groupId>itg</groupId>
<artifactId>ymlean1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>


 

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>




要重写:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;

import java.util.Properties;


@SpringBootApplication
@EnableScheduling
public class SpringBeanApplication extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBeanApplication.class);
}




WAR部署TOMCAT


拷贝itgjob.war到目录:webapps


修改CONF文件夹下的server.xml

补充一行

        <Context path="/" docBase="itgjob.war" debug="0" privileged="true" reloadable="true"/>



spring boot 定时程序发布WAR   WAR部署TOMCAT_tomcat



备注项目更换SDK:

File-->Project Structure: project SDK--New a sdk.