为 spring-boot 关闭执行器安全
Turn off actuator security for spring-boot
我正在关注 lynda.com 上的 spring-引导教程
https://www.lynda.com/Spring-tutorials/Spring-Boot-Actuator/653258/709599-4.html?autoplay=true
主持人只是说关掉
管理安全
这就是 application.yml 的样子
management:
security:
enabled: false
---
spring:
profiles: dev
server:
port:8000
---
spring:
profiles: test
server:
port:9000
这就是主要 class 的样子
package com.frankmoley.boot.essentials.initialbootapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class InitialBootAppApplication {
public static void main(final String[] args) {
SpringApplication.run(InitialBootAppApplication.class, args);
}
@RestController
@RequestMapping("/api")
public class ApiController {
@GetMapping("/greeting")
public String getGreeting() {
return "Hey, this is my custom string message!!!";
}
}
}
现在,他没有经过明确的登录,也没有在这里进行身份验证。如果安全性关闭,它应该让我看到 localhost:8080/mappings 和 localhost:8080/health 也应该向我显示整个消息。
但是,我没有看到额外的信息。
在我的日志中,我看到了这段文字
2018-07-31 13:35:01.048 INFO 5068 --- [nio-8080-exec-2] s.b.a.e.m.MvcEndpointSecurityInterceptor : Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.
有没有办法将 application.yml 某处设置为默认属性文件,我在这里缺少什么?
您的 yml 文件中可能有错误。为 "enabled" 添加缩进。
management:
security:
enabled: false
或者您可以使用 属性 文件 (.properties),这对您来说可能更具可读性:
management.security.enabled=false
我正在关注 lynda.com 上的 spring-引导教程 https://www.lynda.com/Spring-tutorials/Spring-Boot-Actuator/653258/709599-4.html?autoplay=true 主持人只是说关掉 管理安全 这就是 application.yml 的样子
management:
security:
enabled: false
---
spring:
profiles: dev
server:
port:8000
---
spring:
profiles: test
server:
port:9000
这就是主要 class 的样子
package com.frankmoley.boot.essentials.initialbootapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class InitialBootAppApplication {
public static void main(final String[] args) {
SpringApplication.run(InitialBootAppApplication.class, args);
}
@RestController
@RequestMapping("/api")
public class ApiController {
@GetMapping("/greeting")
public String getGreeting() {
return "Hey, this is my custom string message!!!";
}
}
}
现在,他没有经过明确的登录,也没有在这里进行身份验证。如果安全性关闭,它应该让我看到 localhost:8080/mappings 和 localhost:8080/health 也应该向我显示整个消息。 但是,我没有看到额外的信息。 在我的日志中,我看到了这段文字
2018-07-31 13:35:01.048 INFO 5068 --- [nio-8080-exec-2] s.b.a.e.m.MvcEndpointSecurityInterceptor : Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.
有没有办法将 application.yml 某处设置为默认属性文件,我在这里缺少什么?
您的 yml 文件中可能有错误。为 "enabled" 添加缩进。
management:
security:
enabled: false
或者您可以使用 属性 文件 (.properties),这对您来说可能更具可读性:
management.security.enabled=false