C/C++教程

Whitelabel Error Page -----This application has no explicit mapping for /error, so you are seeing th

本文主要是介绍Whitelabel Error Page -----This application has no explicit mapping for /error, so you are seeing th,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

出现这个异常说明了跳转页面的url没有对应的值:

第一点:

  Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 

  原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.

第二点:

  在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题: 

  当pom文件下的spring-boot-starter-paren版本高的时候使用: 

    spring.mvc.view.prefix  /   spring.mvc.view.suffix 

  当pom文件下的spring-boot-starter-paren版本低的时侯使用: 

    spring.view.prefix   /    spring.view.suffix

第三点:

  控制器的URL路径书写问题 
    @RequestMapping(“xxxxxxxxxxxxxx”) 
    实际访问的路径与”xxx”不符合.

如果使用的shiro框架:其第三点配置

#暴露session的属性
spring.freemarker.expose-session-attributes=true
#配置为传统模式,空白值的处理
spring.freemarker.settings.classic_compatible=true
#重新指定模板文件后缀 springboot 2.2.x 后 默认后缀为 .ftlh
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates/
这篇关于Whitelabel Error Page -----This application has no explicit mapping for /error, so you are seeing th的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!