Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 弹簧启动执行器不工作,STS中的application.properties未知_Java_Spring_Spring Boot - Fatal编程技术网

Java 弹簧启动执行器不工作,STS中的application.properties未知

Java 弹簧启动执行器不工作,STS中的application.properties未知,java,spring,spring-boot,Java,Spring,Spring Boot,尝试使用Web和执行器相关性测试启动器,但执行器端点未启用 我希望在以下位置按照文档记录映射/执行器/运行状况 我在应用程序中尝试了各种属性。属性: management.security.enabled=false management.endpoints.web.exposure.include=* management.endpoints.web.expose=* 在STS中,所有三行都带有黄色下划线,并带有指示未知属性的消息 我没有接触Spring Initializer生成的

尝试使用Web执行器相关性测试启动器,但执行器端点未启用

我希望在以下位置按照文档记录映射/执行器/运行状况

我在应用程序中尝试了各种属性。属性

management.security.enabled=false 

management.endpoints.web.exposure.include=*

management.endpoints.web.expose=*
在STS中,所有三行都带有黄色下划线,并带有指示未知属性的消息

我没有接触Spring Initializer生成的pom.xml文件:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.geodepe.test</groupId>
<artifactId>health1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>health1</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.4.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>
</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>
        </plugin>
    </plugins>
</build>
有谁能告诉我我遗漏了什么,为什么STS不能识别这些属性

这与“SpringBoot 2.0.1中未提供执行器/刷新”不同。下面的解决方案显示这是一个JAR损坏问题。

运行后

mvn clean install 
我看到了多个错误,尽管IDE一直在运行而没有告诉我(奇怪)

删除JAR后:

rm /Users/xxx/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.0.4.RELEASE/spring-boot-actuator-autoconfigure-2.0.4.RELEASE.jar
rm /Users/xxx/.m2/repository/org/springframework/boot/spring-boot-actuator/2.0.4.RELEASE/spring-boot-actuator-2.0.4.RELEASE.jar
rm /Users/xxx/.m2/repository/io/micrometer/micrometer-core/1.0.6/micrometer-core-1.0.6.jar

mvn spring-boot:run
强制重新下载

现在我看到了指示暴露端点的日志:

/致动器/健康部现在生产:


我在我的案例中添加了我的自定义健康指标:

 @Component
 public class HealthIndicator implements ReactiveHealthIndicator {

     @Override
     public Mono<Health> health() {
       return checkDownstreamServiceHealth().onErrorResume(
          ex -> Mono.just(new Health.Builder().down(ex).build())
       );
     }

     private Mono<Health> checkDownstreamServiceHealth() {
       return Mono.just(new Health.Builder().up().build());
     }
 }
@组件
公共类HealthIndicator实现了ReactiveHealthIndicator{
@凌驾
公共卫生(){
返回checkDownstreamServiceHealth().onErrorResume(
ex->Mono.just(new Health.Builder().down(ex.build())
);
}
private Mono CheckDownstreamService Health(){
返回Mono.just(新的Health.Builder().up().build());
}
}

我使用弹簧靴执行器2.2.3。从

中,您不能从属性中禁用spring security添加
spring boot starter actuator
依赖性就足够了,您已经有了。你不应该有这些属性。您是否已尝试在application.properties中删除这些属性?请尝试重新生成项目并重新运行。有时,如果jar未完全下载,而您启动了应用程序,则执行器端点不可用
rm /Users/xxx/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.0.4.RELEASE/spring-boot-actuator-autoconfigure-2.0.4.RELEASE.jar
rm /Users/xxx/.m2/repository/org/springframework/boot/spring-boot-actuator/2.0.4.RELEASE/spring-boot-actuator-2.0.4.RELEASE.jar
rm /Users/xxx/.m2/repository/io/micrometer/micrometer-core/1.0.6/micrometer-core-1.0.6.jar
mvn spring-boot:run
 @Component
 public class HealthIndicator implements ReactiveHealthIndicator {

     @Override
     public Mono<Health> health() {
       return checkDownstreamServiceHealth().onErrorResume(
          ex -> Mono.just(new Health.Builder().down(ex).build())
       );
     }

     private Mono<Health> checkDownstreamServiceHealth() {
       return Mono.just(new Health.Builder().up().build());
     }
 }