Giter Club home page Giter Club logo

web_config's Introduction

Spring Boot项目全局错误处理包含页面和API的统一错误处理

  • 配置项目异常统一处理方法和返回页面

支持thymeleaf

这里使用thymeleaf示例,在类com.knight.configdemo.config.WebMVCConfig中是配置thymeleaf的相关配置都是模板代码。 WebMVCConfig

定义API响应风格

通过自定义类实现,在类com.knight.configdemo.base.ApiResponse中实现,AppErrorController

web错误全局处理Controller

在spring boot中通过实现类org.springframework.boot.autoconfigure.web.ErrorController处理全局错误;详情见类com.knight.configdemo.base.AppErrorController 在上面的类中配置错误页面处理和API接口处理 AppErrorController

添加异常页面

properties文件中已经配置了thymeleaf的路径,在templates目录下新建404.html、403.html、500.html文件 templates

web_config's People

Contributors

cavaliersfor avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.