SpringBoot打包成war包并部署到tomcat容器中

1、修改Application类,复写configure方法

@SpringBootApplication
@MapperScan("")
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

2、修改pom.xml


    org.springframework.boot
    spring-boot-starter-web
    
    
        
            org.springframework.boot
            spring-boot-starter-tomcat
        
    


    javax.servlet
    javax.servlet-api
    3.1.0
    provided

3、打包

mvn clean package

4、乱码问题。修改tomcat的server.xml配置文件,如下:


你可能感兴趣的:(SpringBoot打包成war包并部署到tomcat容器中)