18

endpoints.health.pathプロパティをに設定しました/ping/meしかし、 http://localhost:9000/ping/meを使用してエンドポイントにアクセスできませんhttp://localhost:9000/health でのみ機能します。何が欠けていますか?アプリ プロパティ ファイルのコードは次のとおりです。

#Configuration for Health endpoint
endpoints.health.id=health
endpoints.health.path=/ping/me
endpoints.health.enabled=true
endpoints.health.sensitive=false

#Manage endpoints
management.port=9000
management.health.diskspace.enabled=false

私が得る応答は次のとおりです。

{
"timestamp" : 1455736069839,
"status" : 404,
"error" : "Not Found",
"message" : "Not Found",
"path" : "/ping/me"
}
4

2 に答える 2

7

Spring Boot 2 については以下を参照してください。* https://stackoverflow.com/a/50364513/2193477


MvcEndpoints構成の読み取りを担当しendpoints.{name}.path、その方法で何らかの形でafterPropertiesSet:

for (Endpoint<?> endpoint : delegates) {
            if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) {
                EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint);
                String path = this.applicationContext.getEnvironment()
                        .getProperty("endpoints." + endpoint.getId() + ".path");
                if (path != null) {
                    adapter.setPath(path);
                }
                this.endpoints.add(adapter);
            }
}

は を返すためendpoints.health.path、の設定を拒否します。たぶんバグか何かです。isGenericEndpoint(...)falseHealthEndpoint

更新:どうやらこれはバグであり、1.3.3.RELEASEバージョンで修正されました。/ping/meしたがって、このバージョンではヘルス モニタリング パスとしてを使用できます。

于 2016-02-17T20:15:36.227 に答える