[英]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.