- Mastering Spring Boot 2.0
- Dinesh Rajput
- 179字
- 2021-06-25 21:29:16
Customizing application error pages
Every application has a chance of encountering an error, even if it is an extremely robust application. So, designing custom error pages is important for any enterprise application. Spring Boot applications provide a default error page. You can see one in the following screenshot:

But if you want to use a custom error page for a given status code, you can add a file to the /error folder. You can create a custom error page by using static HTML, FreeMarker, Velocity, Thymeleaf, JSP, and so on. The name of the file should be the exact status code or a series mask.
Let's see the following image to map 404 to a static HTML file; your folder structure would be as follows:

As you can see, I have added a custom 404 error page (static error page 404.html) under the /resource/public/error directory; see the following output from the error page:

As you can see, Spring Boot now displays a custom error page instead of the default WhiteLabel error page as part of auto-configuration.
- 電腦辦公(Windows 7 + Office 2013)入門與提高(超值版)
- Word排版技術(shù)大全(第2版)
- 商務(wù)PPT視覺設(shè)計高手18課
- Word/Excel 2010辦公應(yīng)用從入門到精通
- The Art of CRM
- Word/Excel 2016商務(wù)辦公實戰(zhàn)從新手到高手
- Word排版之道
- Word/Excel/PPT實戰(zhàn)技術(shù)大全
- 零基礎(chǔ)學(xué)Python
- Flash CS6核心應(yīng)用案例教程(全彩慕課版)
- 和秋葉一起學(xué)Excel(第2版)
- 辦公自動化精品教程
- 辦公自動化教程(第2版)
- 精P之道:高效溝通PPT
- Excel 2013從新手到高手