SpringBoot-异常问题总结
一:创建的SpringBoot项目之后测试访问接口报错:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
原因1:
Application启动类的位置不对.要将Application(启动类)类放在最外侧,即包含所有子包,spring-boot会自动加载启动类所在包下及其子包下的所有组件.
原因2:
在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
原因3:
控制器的URL路径书写问题
@RequestMapping(“xxxxxxxxxxxxxx”)
实际访问的路径与”xxx”不符合.
我的原因:
@Controller
public class HelloController {
@RequestMapping("/hello")
public String hello(){
return "hello SpringBoot!!";
}
} 二:
SpringBoot-异常问题总结的更多相关文章
- springBoot异常统一处理
springBoot异常统一处理 采用@ControllerAdvice注解和@ExceptionHandler注解,可以对异常进行统一处理. 1.结构图: 2.pom.xml文件: <?xml ...
- springboot 异常: Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-07-31 11:56:18.812 WARN 10316 --- [ main] ConfigServletWebServerApplicationContext : Exception ...
- 深度分析:SpringBoot异常捕获与封装处理,看完你学会了吗?
SpringBoot异常处理 简介 日常开发过程中,难免有的程序会因为某些原因抛出异常,而这些异常一般都是利用try ,catch的方式处理异常或者throw,throws的方式抛出异常不管.这种 ...
- springboot异常错误处理
1.在有模板引擎的情况下: springboot会默认找 templates/error/错误状态码.html,所以我们要定制化错误页面就可以到templates/error下创建一个[对应错误状态码 ...
- Springboot异常:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController'
今天本菜鸟编写程序时,遇到了一个异常. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating ...
- springboot异常
异常如下: org.springframework.context.ApplicationContextException: Unable to start embedded container; n ...
- IDEA创建springboot异常(Failed to load class "org.slf4j.impl.StaticLoggerBinder")
IDEA中创建springboot项目遇到的问题 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". ...
- SpringBoot自定义错误信息,SpringBoot适配Ajax请求
SpringBoot自定义错误信息,SpringBoot自定义异常处理类, SpringBoot异常结果处理适配页面及Ajax请求, SpringBoot适配Ajax请求 ============== ...
- 关于springboot 打包问题 jar包和 war包
起因:项目开发完成 需要打包部署了 发现自己不会打包 那么开始网上学习打包? 那么怎么来打包那? 我们以前没有采用springboot 时候我们都是直接将项目打成war包形式 然后放到tomc ...
- SpringBoot源码学习系列之异常处理自动配置
SpringBoot源码学习系列之异常处理自动配置 1.源码学习 先给个SpringBoot中的异常例子,假如访问一个错误链接,让其返回404页面 在浏览器访问: 而在其它的客户端软件,比如postm ...
随机推荐
- @NotNull @NotEmpty @NotBlank区别
@interface NotNull The annotated element must not be {@code null}.Accepts any type.----------------- ...
- NFV-Based Scalable Guaranteed-Bandwidth Multicast Service for Software Defined ISP Networks
文章名称:NFV-Based Scalable Guaranteed-Bandwidth Multicast Service for Software Defined ISP Networks 发表时 ...
- Python菜鸟快乐游戏编程_pygame(2)
Python菜鸟快乐游戏编程_pygame(博主录制,2K分辨率,超高清) https://study.163.com/course/courseMain.htm?courseId=100618802 ...
- NameNode和SecondaryNameNode工作原理剖析
NameNode和SecondaryNameNode工作原理剖析 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.NameNode中的元数据是存储在那里的? 1>.首先,我 ...
- Helm包管理工具(简介、安装、方法)
认识Helm 每次我们要部署一个应用都需要写一个配置清单(维护一套yaml文件),但是每个环境又不一样.部署一套新的环境成本是真的很高.如果我们能够使用类似于yum的工具来安装我们的应用的话那就太好了 ...
- [JDK8] Stream
1 collect(toList()) collect(toList()) 方法由Stream 里的值生成一个列表,是一个及早求值操作. 2 map 如果有一个函数可以将一种类型的值转换成另外一种类型 ...
- nautilus-open-terminal----在当前目录下打开终端
nautilus-open-terminal很有用的插件--鼠标右键打开终端 1.1 fedora安装 # yum -y install nautilus-open-terminal安装nautilu ...
- tensorflow 莫烦教程
1,感谢莫烦 2,第一个实例:用tf拟合线性函数 import tensorflow as tf import numpy as np # create data x_data = np.random ...
- 终于有人把P2P、P2C、O2O、B2C、B2B、C2C 的区别讲透了!
原文地址:https://www.cnblogs.com/sap-ronny/p/8149960.html P2P.P2C .O2O .B2C.B2B. C2C,每天看着这些常见又陌生的名词,如果有人 ...
- webpack2 实践
实例gif图: 目录截图: 目录介绍: dist目录(最后生成的目录,里面文件为配置webpack自动生成的): c/:css文件夹; i/:img文件夹; j/:js文件夹; src目录下(开发目录 ...