您好,登錄后才能下訂單哦!
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://javadeveloperzone.com/spring-boot/spring-boot-startup-failure-analyzer-example/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。