《Springboot极简教程》问题解决:Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping for

简介: Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Mar 28 22:25:43 CST 2017
There was an unexpected error (type=Internal Server Error, status=500).
Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

首先,这个出错页面是SpringBoot的一个默认出错页面。源码在:org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration 第151行。
这种错误一般是配置错误,或者MVC报错引起的错误。
比如说,在newer versions of Spring, following needs to be put in application.properties file:

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

Also, JSP files need to be put under src/main/resources/META-INF/resources/WEB-INF/jsp

推荐直接使用java代码配置的方式,这样方便看代码:

package com.restfiddle.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by jack on 2017/3/28.
 *
 * @author jack
 * @date 2017/03/28
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        //spring.view.prefix=/WEB-INF/jsp/
        //spring.view.suffix=.jsp
        registry.jsp("/WEB-INF/jsp/", ".jsp");
        //registry.freeMarker();
        //registry.velocity();
        //registry.groovy();
    }

}

问题参考:

http://stackoverflow.com/questions/27113452/circular-view-path-in-a-simple-spring-boot-project-with-a-controller

相关文章
|
5月前
|
缓存 Java Maven
Spring Boot 启动错误:To display the conditions report re-run your application with ‘debug‘ enable —【已解决】
Spring Boot 启动错误:To display the conditions report re-run your application with ‘debug‘ enable —【已解决】
718 1
|
5月前
|
Java 数据库
SpringBoot整合es7.x启动报错:Rejecting mapping update to [AAA] as the final mapping would have more than 1
SpringBoot整合es7.x启动报错:Rejecting mapping update to [AAA] as the final mapping would have more than 1
|
4月前
|
Java Spring
Spring Boot Application in default package
Spring Boot Application in default package
|
6月前
|
Java 数据库连接 Spring
【SpringBoot】Error starting ApplicationContext. To display the conditions report re--run your app
【SpringBoot】Error starting ApplicationContext. To display the conditions report re--run your app
246 0
|
6月前
|
SQL Java 调度
SpringBoot集成quartz定时任务trigger_state状态ERROR解决办法
SpringBoot集成quartz定时任务trigger_state状态ERROR解决办法
|
6月前
|
Java
springboot启动报错:“Error starting ApplicationContext. To display the conditions report re-run your appl
springboot启动报错:“Error starting ApplicationContext. To display the conditions report re-run your appl
406 0
|
6月前
|
NoSQL MongoDB 数据库
MongoDB【部署 03】Windows系统安装mongodb并设置用户名密码(无需安装mongosh)及SpringBoot集成报错 Command failed with error 18
MongoDB【部署 03】Windows系统安装mongodb并设置用户名密码(无需安装mongosh)及SpringBoot集成报错 Command failed with error 18
543 0
|
6月前
|
XML Java 数据库
SpringBoot【问题 03】BindingException\MalformedInputException\Error querying database(sqlite数据库)
SpringBoot【问题 03】BindingException\MalformedInputException\Error querying database(sqlite数据库)
148 0
|
6月前
|
Java Linux Windows
windows解决SpringBoot启动时:APPLICATION FAILED TO START
windows解决SpringBoot启动时:APPLICATION FAILED TO START
252 0
下一篇
无影云桌面