springboot:This application has no explicit mapping for /erro

springboot启动没有报错,但是访问的时候返回如上图的错误。看报错内容感觉是没有这个mapping对应的接口。但是确实写了。

最终发现是因为springboot的启动类放的位置不对。启动类所在的package必需要包含Controller所在的package。简单来说放到最外层最安全。

原文地址:https://www.cnblogs.com/JavaZhangXu/p/9878741.html

时间: 2024-10-11 14:42:27

springboot:This application has no explicit mapping for /erro的相关文章

SpringBoot启动报错【This application has no explicit mapping for /error.....】

今天做SpringBoot小例子,在请求controller层的时候出现如下问题. Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Dec 14 16:35:25 CST 2016 There was an unexpected error (type=Not Found, status=404). No mes

1. SpringBoot启动后,报异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.

出现这个异常说明了跳转页面的url无对应的值. 原因1: Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件. 原因2: 在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题: 当pom文件下的spring-boot-starter-paren版本高时使用: spring.mvc.view.pre

异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.

出现这个异常说明了跳转页面的url无对应的值. 原因1: Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包 原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件. 原因2: 在springboot的配置文件:application.yml或application.properties中关于视图解析器的配置问题: 当pom文件下的spring-boot-starter-paren版本高时使用: spring.mvc.view.pre

SpringBoot读取application.properties文件

SpringBoot读取application.properties文件,通常有3种方式 1. @Value  例如: @Value("${spring.profiles.active}") private String profileActive;------相当于把properties文件中的spring.profiles.active注入到变量profileActive中 2. @ConfigurationProperties  例如: @Component@Configurat

springboot配置文件application.properties

# =================================================================== # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its # entirety to your own application. ^^^ # ===================================

SpringBoot 配置文件application.properties

# =================================================================== # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its # entirety to your own application.               ^^^ # =====================

springboot 配置文件application

application.properties # ----------------------------------------# 核心属性# ---------------------------------------- # 文件编码banner.charset= UTF-8# 文件位置banner.location= classpath:banner.txt # 日志配置# 日志配置文件的位置. 例如对于Logback的`classpath:logback.xml`logging.con

SpringBoot配置文件application.properties详解

相信很多的码友在接触springboot时,不知道怎么去配置一些项目中需要的配置,比如数据源,tomcat调优,端口等等,下面我就给大家奉献出一些项目中常用的配置信息. 如何偏差的地址欢迎大家来指正. 配置文件比较多,自己寻找所需要的,后面我会给大家推荐几个常用的配置文件. # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

springboot的application.properties与.yml的区别

现在我们的application.properties文件内容是: [plain] view plain copy server.port=8090 server.session-timeout=30 server.context-path= server.tomcat.max-threads=0 server.tomcat.uri-encoding=UTF-8 spring.datasource.url = jdbc:mysql://localhost:3306/newbirds spring