Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot 2 - Actuator endpoint, where is /beans endpoint

In a spring boot 2 application I'm trying to access actuator endpoint /beans as I did before in Spring boot 1.5.* applications. But I'm unable to. Also, I don't see the endpoint is being created in the log.INFO.

My pom.xml contains:

<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>

in application.properties I only have info about the databaseconnectivity:

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/somedb
spring.datasource.username=someuser
spring.datasource.password=somepass

As mapped endpoints I see in the info logs:

/actuator/health
/actuator/info
/actuator

The application is working but no /application/beans endpoint is created.

How come my /beans or /application/beans endpoint is not generated and what should I change to make it exist?

like image 613
xtra Avatar asked Mar 08 '18 13:03

xtra


People also ask

How do you find the spring actuator endpoints?

When we add Spring Actuator Dependencies to our spring boot project, it automatically enables actuator endpoints. Add below dependencies to your spring application to enable spring boot actuator endpoints. Now when you will run the application, you will see actuator endpoints being mapped in the logs.

Which endpoint is spring boot actuator?

We can use HTTP and JMX endpoints to manage and monitor the Spring Boot application. If we want to get production-ready features in an application, we should use the Spring Boot actuator.

Which endpoints do you use in actuator?

Actuator is mainly used to expose operational information about the running application — health, metrics, info, dump, env, etc. It uses HTTP endpoints or JMX beans to enable us to interact with it.


1 Answers

According to the reference documentation this endpoint is no longer exposed via "web" by default.

First, you need to make sure that the "beans" endpoint is actually enabled:

management.endpoint.beans.enabled=true

in your spring-boot-configuration. Then, you need to include it in the "web" exposure:

management.endpoints.web.exposure.include=beans

or maybe even

management.endpoints.web.exposure.include=*

See https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/reference/htmlsingle/#production-ready-endpoints-enabling-endpoints for further information.

like image 101
David Avatar answered Sep 18 '22 22:09

David