编写xml 打包方式为war
war
编写入口类继承SpringBootServletInitializer重写configure方法
package com.kaiguo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@SpringBootApplication
public class ApplicationRun extends SpringBootServletInitializer {
public static void main(String[] args) {
ConfigurableApplicationContext run = SpringApplication.run(ApplicationRun.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(ApplicationRun.class);
}
}
加入SpringBoot打包插件
org.springframework.boot spring-boot-maven-plugin
为了避免有的资源没有打到包里面去所以必须添加资源路径
src/main/java ***.* src/main/webapp meta-INF/resources **/*.*



