审查视图

src/main/java/com/tianbo/analysis/config/ErrorPageConfig.java 818 字节
朱兆平 authored
1
package com.tianbo.analysis.config;
朱兆平 authored
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;


/**
 * @descrption 需要解决srpingboot error页面模板
 * @author mrz
 * @date 20190414
 */
@Component
public class ErrorPageConfig implements ErrorPageRegistrar {

    @Override
    public void registerErrorPages(ErrorPageRegistry registry){
        ErrorPage[] errorPages=new ErrorPage[2];
21 22
        errorPages[0]=new ErrorPage(HttpStatus.NOT_FOUND,"/error/404");
        errorPages[1]=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error/500");
朱兆平 authored
23 24 25 26 27

        registry.addErrorPages(errorPages);
    }

}