我正在尝试使用带有以下网址的浏览器访问 Spring Boot 的管理端点之一:http://localhost:9080/env
这是我的配置:
management.port: 9080
management.address: 127.0.0.1
我总是收到 400 bad request
错误 ...
以下是完整的输出:
Request URL:http://localhost:9080/env
Request Method:GET
Status Code:400 Bad Request
Request Headers
GET /env HTTP/1.1
Host: localhost:9080
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Basic dXNlcjo0YWI0ZDRjMi1mYmIyLTQxYmYtODc0MS04YTk3YWQwZDE3ZWI=
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: fr-FR,fr;q=0.8,en;q=0.6,es;q=0.4,en-GB;q=0.2
Cookie: JSESSIONID=0A00A8C2431F58BF6CD3A9F12822820C
Response Headers
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 968
Date: Wed, 05 Mar 2014 14:09:13 GMT
Connection: close
有人可以帮忙吗?
答案 0 :(得分:1)
我找到了问题的答案:
为了获得宁静的管理端点需要Spring Boot Actuator 。
任何使用Spring Boot with Actuator的应用程序都会启用那些安静的管理端点。
编辑:必要的Maven依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>