[英]Spring boot 2 - Actuator endpoint, where is /beans endpoint
在 spring boot 2 應用程序中,我試圖訪問執行器端點 /beans,就像我之前在 Spring boot 1.5.* 應用程序中所做的那樣。 但我做不到。 此外,我沒有在 log.INFO 中看到正在創建端點。
我的 pom.xml 包含:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
在 application.properties 我只有關於數據庫連接的信息:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/somedb
spring.datasource.username=someuser
spring.datasource.password=somepass
作為我在信息日志中看到的映射端點:
/actuator/health
/actuator/info
/actuator
應用程序正在運行,但沒有創建 /application/beans 端點。
為什么我的 /beans 或 /application/beans 端點沒有生成,我應該改變什么才能讓它存在?
根據參考文檔,默認情況下,此端點不再通過“web”公開。
首先,您需要確保實際啟用了“beans”端點:
management.endpoint.beans.enabled=true
在你的spring-boot-configuration中。 然后,您需要將其包含在“網絡”曝光中:
management.endpoints.web.exposure.include=beans
或者甚至是
management.endpoints.web.exposure.include=*
對於任何尋找 yaml 規范的人,對於 Spring Boot v2.7.1 ,
management:
endpoint:
beans:
enabled: true
endpoints:
web:
exposure:
include: beans
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.