1.增加mvc支持,一定要注意这种台阶式的配置文件格式,一定要严格对照
2.启动类增加一个重写的方法
import org.apache.log4j.BasicConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 DiscernApplication extends SpringBootServletInitializer {
private static final Logger log =LoggerFactory.getLogger(DiscernApplication.class);
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(DiscernApplication.class);
}
// 启动文件
public DiscernApplication() {
super();
setRegisterErrorPageFilter(false);
}
public static void main(String[] args) {
log.info("EAI"+"-----"+"Start"+"-----"+"recognition");
BasicConfigurator.configure();
SpringApplication.run(DiscernApplication.class, args);
}
}
3.不要引入thymeleaf模板引擎,,我就是在这入了一个坑
4.一定要引入四个比较重要的jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
5.页面在配置文件指定目录下即可
————————————————
6.效果 如图