SpringBoot 2.0.1中未提供执行器/refresh [英] actuator /refresh is not being provided in SpringBoot 2.0.1

查看:150
本文介绍了SpringBoot 2.0.1中未提供执行器/refresh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Spring-Config-ServerSpring-Config-Client创建一个演示项目.

I am creating a demo project for Spring-Config-Server and Spring-Config-Client.

SpringBoot 1.5.6.RELEASE中,一切正常.

但是,当我将项目升级到2.0.1.RELEASE时,它不提供执行器端点.

However, when I am upgrading project to 2.0.1.RELEASE it does not provide the actuator endpoints.

1.5.6.RELEASE

Mapped "{[/refresh || /refresh.json],methods=[POST]}"
Mapped "{[/dump || /dump.json],methods=[GET]
Mapped "{[/heapdump || /heapdump.json],methods=[GET]
Mapped "{[/autoconfig || /autoconfig.json],methods=[GET]
Mapped "{[/resume || /resume.json],methods=[POST]}"
Mapped "{[/configprops || /configprops.json],methods=[GET]
Mapped "{[/features || /features.json],methods=[GET]
Mapped "{[/loggers/{name:.*}],methods=[GET]
Mapped "{[/restart || /restart.json],methods=[POST]}"
...and many more


2.0.1.RELEASE

Mapped "{[/actuator/health],methods=[GET]
Mapped "{[/actuator/info],methods=[GET]
Mapped "{[/actuator],methods=[GET]


pom.xml :2.0.1.RELEASE

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RC1</spring-cloud.version>
    </properties>

<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.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

bw 1.5.6 pom的唯一区别是版本和spring-cloud.version = Dalston.SR2

The only difference bw 1.5.6 pom is version and spring-cloud.version = Dalston.SR2

有人可以帮忙吗?

推荐答案

经过一番研究,我发现Spring Boot 2.0中未显示端点的原因是

After a bit of research, I have found the cause why the endpoints are not shown in Spring Boot 2.0 is as per docs

默认情况下,除关机外的所有端点均已启用

By default, all endpoints except for shutdown are enabled

因此,我们需要手动启用它们.

so, we need to enable them manually.

我在application.properties文件中添加了management.endpoints.web.exposure.include=*,现在所有端点都恢复了.

I have added management.endpoints.web.exposure.include=* in application.properties file and now all the endpoints are back.

注意:如果您使用的是.yml,请确保使用"*"而不是*

Note: If you are using .yml make sure to use "*" not *

这篇关于SpringBoot 2.0.1中未提供执行器/refresh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆