下面列出了org.springframework.http.HttpStatus#FAILED_DEPENDENCY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void checkDependency() {
try {
Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook");
} catch (ClassNotFoundException e) {
throw new ValidationLibException("Not found apache POI library, must import poi to your maven or gradle dependency", HttpStatus.FAILED_DEPENDENCY);
}
}
@RequestMapping("/throw4xxServerHttpStatusCodeException")
public void throw4xxServerHttpStatusCodeException() {
HttpClientErrorException serverResponseEx = new HttpClientErrorException(HttpStatus.FAILED_DEPENDENCY, "ignoreme", responseBodyForDownstreamServiceError(), null);
throw new ServerHttpStatusCodeException(new Exception("Intentional test exception"), "FOO", serverResponseEx, serverResponseEx.getStatusCode().value(), serverResponseEx.getResponseHeaders(), serverResponseEx.getResponseBodyAsString());
}