Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.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
Rest 带执行器的弹簧靴应用_Rest_Spring Boot_Spring Mvc_Restful Authentication_Spring Boot Actuator - Fatal编程技术网

Rest 带执行器的弹簧靴应用

Rest 带执行器的弹簧靴应用,rest,spring-boot,spring-mvc,restful-authentication,spring-boot-actuator,Rest,Spring Boot,Spring Mvc,Restful Authentication,Spring Boot Actuator,我有一个SpringBoot应用程序。2.1.3.JWT安全发布,我想添加一个执行器。我添加了这个依赖项 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 但是

我有一个SpringBoot应用程序。2.1.3.JWT安全发布,我想添加一个执行器。我添加了这个依赖项

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency> 
但是当我进入邮递员的
http://127.0.0.1:8080/myApp/actuator/

我有一个

{
    "timestamp": "2019-03-21T16:39:47.877+0000",
    "status": 401,
    "error": "Unauthorized",
    "message": "Unauthorized",
    "path": "/myApp/actuator/"
}
HTTP状态404–未找到


访问
http://127.0.0.1:8080/actuator/

默认情况下,URL为:

http://localhost:8080/actuator
尝试从更改您的配置

        .antMatchers(
                HttpMethod.GET,
                "/actuator"
            )


Spring引导执行器包含多个端点,包括运行状况、指标等

端点的访问方式如下:

http://{baseUrl}/autuator/health

http://{baseUrl}/autuator/metrics

因此,获取所有端点-http://{baseUrl}/autuator/**[get-Request]

因此,要允许在安全配置中访问此端点,请将配置从更改为

            .antMatchers(
                    HttpMethod.GET,
                    "/actuator"
                )


您使用的是
GET
还是
POST
        .antMatchers(
                HttpMethod.GET,
                "/actuator/**"
            )
            .antMatchers(
                    HttpMethod.GET,
                    "/actuator"
                )
            .antMatchers(
                    HttpMethod.GET,
                    "/actuator/**"
                )