Creating custom ErrorWebExceptionHandler fails

前端 未结 3 1648
无人共我
无人共我 2021-02-19 18:46

I am trying to create my own ErrorWebExceptionHandler in Spring Boot 2 by extending the default one but my application fails to start with the following message:

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 19:26

    Please try to add dependency of ServerCodecConfigurer in your constructor

    GlobalErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties, ApplicationContext applicationContext, ServerCodecConfigurer configurer) { super(errorAttributes, resourceProperties, applicationContext); this.setMessageWriters(configurer.getWriters()); }

提交回复
热议问题