2.0.0之前使用:

@Autowired
private ErrorAttributes errorAttributes; private Map<String, Object> getErrorAttributes(HttpServletRequest request,
boolean includeStackTrace) {
RequestAttributes requestAttributes = new ServletRequestAttributes(request);
return this.errorAttributes.getErrorAttributes(requestAttributes,
includeStackTrace);
}

后续版本使用:

@Autowired
private ErrorAttributes errorAttributes;
private Map<String, Object> getErrorAttributes(HttpServletRequest request,
boolean includeStackTrace) {
ServletWebRequest servletWebRequest = new ServletWebRequest(request);
return this.errorAttributes.getErrorAttributes(servletWebRequest,
includeStackTrace);
}
 

springboot新版本(2.0.0+)自定义ErrorController中使用ErrorAttributes的更多相关文章

  1. springboot - 使用ErrorAttributes 在我们自定义的 ErrorController中

    1.概览 基于<springboot - 映射 /error 到自定义且实现了ErrorController的Controller>改造,仅将MyCustomErrorController ...

  2. 【转】SpringBoot 2.0.0新版和SpringBoot1.5.2版本中Tomcat配置的差别

    https://blog.csdn.net/wd2014610/article/details/79587161 2018年春SpringBoot 2.0.0 新版本有了很多新的改变,其中Tomcat ...

  3. solr8.0.0基本安装和在springboot中的基本使用(win10)

    1.下载solr 下载地址:http://archive.apache.org/dist/lucene/solr/ 该地址可以也可以下载以前的版本,我这边下载的solr-8.0.0.zip版本.下载完 ...

  4. springboot+spring security +oauth2.0 demo搭建(password模式)(认证授权端与资源服务端分离的形式)

    项目security_simple(认证授权项目) 1.新建springboot项目 这儿选择springboot版本我选择的是2.0.6 点击finish后完成项目的创建 2.引入maven依赖  ...

  5. SpringBoot2.x过滤器Filter和使用Servlet3.0配置自定义Filter实战

    补充:SpringBoot启动日志 1.深入SpringBoot2.x过滤器Filter和使用Servlet3.0配置自定义Filter实战(核心知识) 简介:讲解SpringBoot里面Filter ...

  6. springboot - 返回xml error 从自定义的 ErrorController

    1.概览 2.在<springboot - 返回JSON error 从自定义的 ErrorController>基础上,做如下调整: 1).新增Attribute类和Error类 pac ...

  7. .NET微信公众号开发-2.0创建自定义菜单

    一.前言 开发之前,我们需要阅读官方的接口说明文档,不得不吐槽一下,微信的这个官方文档真的很烂,但是,为了开发我们需要的功能,我们也不得不去看这些文档. 接口文档地址:http://mp.weixin ...

  8. .NET微信公众号开发-3.0查询自定义菜单

    一.前言 前面我们已经创建好了我们的自定义菜单.那么我们现在要如何查询我们自定义的菜单.原理都是一样的,而且都是相当简单,只是接口地址文档换掉了. 2.0开始编码 同样我们首先创建好我的查询页面,在这 ...

  9. 【使用WCF,发布服务端浏览报错】未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” 中加载类型 “System.ServiceModel.Activation.HttpModule”。

    问题: 在WIN7中的IIS服务器中部署WCF服务程序时,通过浏览器访问报出如下错误: 未能从程序集"System.ServiceModel, Version=3.0.0.0, Cultur ...

随机推荐

  1. [C#] 改进SqliteHelper, 减少拼接SQL语句

    说明:开始几个是基本的方法,后面稍微封装了下 public class SqliteHelper { //连接字符串 private static readonly string str = Conf ...

  2. centos7环境下redis的安装

    一.redis的安装 1.获取redis的安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz,如果未安装wget,先安装wget ...

  3. Delphi - Indy 创建邮件自动发送服务

    服务器自动邮件线程 功能:此程序主要实现对Oracle数据库表tableName(存放需要发送邮件的相关信息)里面相关信息的邮件发送. 优点:开发人员可以直接再数据库后台对tableName表进行插入 ...

  4. java设计模式7.策略模式、模板方法模式、观察者模式

    策略模式 策略模式的用意,将每一个算法封装到具有共同接口的独立的类中,从而使得它们可以相互替换.策略模式使得算法可以在不影响到客户端的情况下发生变化. 环境角色:持有一个抽象策略角色的引用. 抽象策略 ...

  5. Codeforces Round #511 (Div. 2)-C - Enlarge GCD (素数筛)

    传送门:http://codeforces.com/contest/1047/problem/C 题意: 给定n个数,问最少要去掉几个数,使得剩下的数gcd 大于原来n个数的gcd值. 思路: 自己一 ...

  6. lightoj 1105 - Fi Binary Number(dp+思维(斐波那契))

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1105 题解:这题你会巧妙的发现 1-(1),2-(10),3-(100),5- ...

  7. lightoj 1097 - Lucky Number(线段树)

    Lucky numbers are defined by a variation of the well-known sieve of Eratosthenes. Beginning with the ...

  8. 获得本机IP和访问服务的端口号(Java)

    1. //获取本机ip地址 InetAddress addr = InetAddress.getLocalHost(); String ip=addr.getHostAddress().toStrin ...

  9. netcore 基于 DispatchProxy 实现一个简单Rpc远程调用

    前言 netcore 发布以来,一直很关注netcore的进程.目前在公司负责的网站也历经波折的全部有.net framework 4.0 全部切换到netcore 2.2 版本中.虽然过程遇到的坑不 ...

  10. 【第十一篇】这一篇来说说MVC+EF+easyui datagrid的查询功能

    老规矩 直接上代码 <form class="form-horizontal"> <div class="box-body"> < ...