本文共 765 字,大约阅读时间需要 2 分钟。
FailedAnalyzer 自定义实现
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
原文地址:
转载于:https://blog.51cto.com/881206524/2123048