spring-boot集成 jsp报whitelabel error page的问题解决
2018-03-12 17:04
801 查看
方法1: 用maven命令启动,mvn spring-boot:run
方法2:检查springboot内置tomcat上下文默认路径
打印tomcat上下文路径看看是否正确
public static void main(Stringp[] args){
ConfigurableApplicationContext context = SpringApplication.run(ApplicationMain.class, args);
ServletContext context1 = context.getBean(ServletContext.class);
URL url = context1.getResource("/");
System.out.prinltn(url.getFile());
}
如果不正确修改,修改方法如下,加一个配置类:
@Configuration
public class TomcatConfig {
@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
ConfigurableEmbeddedServletContainer factory = new TomcatEmbeddedServletContainerFactory();
//设置为自己的路径
factory.setDocumentRoot(new File("D:\\workspace\\spring-boot-helloworld\\src\\main\\webapp\\"));
return (EmbeddedServletContainerFactory) factory;
}
}
方法2:检查springboot内置tomcat上下文默认路径
打印tomcat上下文路径看看是否正确
public static void main(Stringp[] args){
ConfigurableApplicationContext context = SpringApplication.run(ApplicationMain.class, args);
ServletContext context1 = context.getBean(ServletContext.class);
URL url = context1.getResource("/");
System.out.prinltn(url.getFile());
}
如果不正确修改,修改方法如下,加一个配置类:
@Configuration
public class TomcatConfig {
@Bean
public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
ConfigurableEmbeddedServletContainer factory = new TomcatEmbeddedServletContainerFactory();
//设置为自己的路径
factory.setDocumentRoot(new File("D:\\workspace\\spring-boot-helloworld\\src\\main\\webapp\\"));
return (EmbeddedServletContainerFactory) factory;
}
}
相关文章推荐
- spring-boot jsp whitelabel error page问题解决
- springboot + tomcat + jsp 报Whitelabel Error Page解决方法
- 《Springboot极简教程》问题解决:Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping for
- 《Springboot极简教程》问题解决:Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping for(转)
- SpringBoot中jsp页面调用iframe标签报Whitelabel Error Page 错误
- Spring-Boot "Whitelabel Error Page" 解决方法总结
- 初学Spring Boot遇到Whitelabel Error Page的解决办法
- Spring Boot Whitelabel Error Page解决办法
- spring boot2.0 创建 及 mvc视图映射 jsp时 Whitelabel Error Page(一)
- Spring boot JSP访问页面显示Whitelabel Error Page
- spring boot: Whitelabel Error Page的解决方案
- Spring Boot 第一个HelloWorld程序 whitelabel Error Page
- Spring Boot自定义错误页面,Whitelabel Error Page处理方式
- SpringBoot 访问出错Whitelabel Error Page
- spring boot: Whitelabel Error Page的解决方案
- Spring Boot自定义错误页面,Whitelabel Error Page处理方式
- Spring boot启动提示Whitelabel Error Page 401 spring需要授权登录
- java处理springboot whitelabel error page
- Whitelabel Error Page(按spring-boot官网的示例跑不起来的原因之一)
- Spring Boot : Whitelabel Error Page解决方案