springboot之FailureAnalyzer-成都快上网建站

springboot之FailureAnalyzer

FailedAnalyzer 自定义实现

创新互联 - 达州电信机房,四川服务器租用,成都服务器租用,四川网通托管,绵阳服务器托管,德阳服务器托管,遂宁服务器托管,绵阳服务器托管,四川云主机,成都云主机,西南云主机,达州电信机房,西南服务器托管,四川/成都大带宽,大带宽服务器,四川老牌IDC服务商

import org.springframework.boot.diagnostics.FailureAnalysis;
import org.springframework.boot.diagnostics.FailureAnalyzer;
/**
 * Created by JavaDeveloperZone on 03-05-2018.
 * Here we have implements FailureAnalyzer and override analyze method which will be
 * called automatically when application startup will get failed.
 */
public class CustomFailedAnalyzer implements FailureAnalyzer {
    @Override
    public FailureAnalysis analyze(Throwable failure) {
        return new FailureAnalysis("Custom Failed Message : ",failure.getMessage(),failure);
    }
}

spring.factories文件配置

org.springframework.boot.diagnostics.FailureAnalyzer=com.javadeveloperzone.CustomFailedAnalyzer

注意:必须放置在resources/META-INF
spring boot之FailureAnalyzer

原文地址:https://javadeveloperzone.com/spring-boot/spring-boot-startup-failure-analyzer-example/


分享标题:springboot之FailureAnalyzer
地址分享:http://kswjz.com/article/ijeihd.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流