spring boot 支持freemarker提示Whitelabel Error Page

2023-06-15,,

错误:This application has no explicit mapping for /error, so you are seeing this as a fallback.
前提:
 1.配置URL正确 (XXXController中的@requestMapping(value="/xxxx"))

 2.springboot的配置文件:application.yml或application.properties中视图解析器的配置正确

分析原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.
故Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包

备注:开始将springboot启动类放到cn.cqs.utils中后引起上面错误,将启动类放到包的根目录中,问题解决

《spring boot 支持freemarker提示Whitelabel Error Page.doc》

下载本文的Word格式文档,以方便收藏与打印。