Spring boot 2 - Actuator端点,其中是/ beans端点

xtr*_*tra 6 java spring spring-boot

在spring boot 2应用程序中,我正在尝试访问执行器端点/ bean,就像之前在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>
Run Code Online (Sandbox Code Playgroud)

在application.properties中我只有关于数据库连接的信息:

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/somedb
spring.datasource.username=someuser
spring.datasource.password=somepass
Run Code Online (Sandbox Code Playgroud)

作为映射的端点,我在信息日志中看到:

/actuator/health
/actuator/info
/actuator
Run Code Online (Sandbox Code Playgroud)

应用程序正在运行但未创建/ application/beans端点.

为什么我的/ beans或/ application/beans端点没有生成,我应该更改它以使其存在?

Dav*_*vid 7

根据参考文档,此端点默认不再通过“ Web”公开。

首先,您需要确保实际启用了“ beans”端点:

management.endpoint.beans.enabled=true
Run Code Online (Sandbox Code Playgroud)

在您的spring-boot-configuration中。然后,您需要将其包含在“网络”展示中:

management.endpoints.web.exposure.include=beans
Run Code Online (Sandbox Code Playgroud)

甚至

management.endpoints.web.exposure.include=*
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参见https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints