标签:configure static XML uil scope conf isp string build
1、添加<.packaging>war</.packaging>,打包为war包
<packaging>war</packaging>
2、不使用SpringBoot内置的Tomcat,添加
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
server.servlet.context-path=/demo
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(App.class); }
修改后的为:
package com.st; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication public class App extends SpringBootServletInitializer{ public static void main(String[] args) throws Exception { SpringApplication.run(App.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(App.class); } }
在webapp目录新建WEB-INF,并新建web.xml文件
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
标签:configure static XML uil scope conf isp string build
原文地址:https://www.cnblogs.com/QW-lzm/p/12394888.html