首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >/驱动器/info端点不使用弹簧引导2.5.0

/驱动器/info端点不使用弹簧引导2.5.0
EN

Stack Overflow用户
提问于 2021-06-08 20:00:25
回答 5查看 16.1K关注 0票数 19

我将我的应用程序中的spring引导版本从2.4.4升级到了2.5.0,它停止了公开/驱动器/info端点。这是pom.xml和application.yml

pom.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.ms</groupId>
    <artifactId>spring-boot-test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-test</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.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.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <layers>
                        <enabled>true</enabled>
                    </layers>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

application.yml

代码语言:javascript
复制
management:
  endpoints:
    jmx:
      exposure:
        include: "health,info"

使用spring父版本2.4.4,应用程序能够公开info端点,但不能公开2.5.0。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2021-06-08 20:11:12

在http上公开执行器urls的正确属性是management.endpoints.web.​exposure.exclude (web而不是jmx)。

在您的示例中,info在早期公开并不是因为您拥有所提供的属性,而是因为默认情况下它是公开的(与health一起)。但是在2.5.0 它变得隐匿起来中,现在需要手动公开它。

票数 22
EN

Stack Overflow用户

发布于 2021-11-26 08:59:03

将其添加到应用程序属性以公开/info端点。

代码语言:javascript
复制
management.info.env.enabled = true
票数 16
EN

Stack Overflow用户

发布于 2021-09-06 11:52:04

在我的例子中,这是一个愚蠢的错误,我有以下依赖性:

代码语言:javascript
复制
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>

而不是:

代码语言:javascript
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

因此,我继续获得所有/actuator调用中找不到的白色标记错误页404。

在application.properties中

代码语言:javascript
复制
#Actuator
management.endpoints.jmx.exposure.include=health,info,env,beans
management.endpoints.web.exposure.include=health,info,env,beans
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67893857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档