1
申し訳ありませんが、私は怠惰な解決策を求めている場合 です。春のフレームワークのデフォルトのエラーページJSON
@SpringBootConfiguration
public class RestWebApplication {
public static void main(String[] args) {
SpringApplication.run(RestWebApplication.class, args);
}
}
しかし、何が実装されていない場合、私は
$ curl localhost:8080
{"timestamp":1384788106983,"error":"Not Found","status":404,"message":""}
を期待しかし
<!DOCTYPE html><html><head><title>Apache Tomcat/8.5.9 - Error report</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style> </head><body><h1>HTTP Status 404 - /</h1><div class="line"></div><p><b>type</b> Status report</p><p><b>message</b> <u>/</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><hr class="line"><h3>Apache Tomcat/8.5.9</h3></body></html>
を手に入れたが、私は何かを逃しましたか? エラーページはJSON出力としてリダイレクトされますか?
ご協力いただきありがとうございます。
ShemoException.class及びGsonUtils.class(又はそれへの参照)してください。 – Markq
あなたのプロジェクトに追加するGsonライブラリが必要な私の答えが更新されました。 – Irakli
新しい応答を取得しました:
ホワイトリストエラーページ
このアプリケーションには/ errorの明示的なマッピングがないため、これをフォールバックとみなしています。