比较简单,直接上代码了。这里仅作记录以免后面需要用的时候忘了
package com.yutangcun.blog.config; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPageRegistrar; import org.springframework.boot.web.server.ErrorPageRegistry; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @Configuration public class ErrorPageConfig implements ErrorPageRegistrar { @Override public void registerErrorPages(ErrorPageRegistry registry) { registry.addErrorPages( new ErrorPage(HttpStatus.NOT_FOUND, "/page/404.html"), new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/page/500.html") ); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)