This is not a web project, but I still add spring-boot-starter-actuator
in pom, and specify management.port=8081
, then in last of run method of CommandLineRunner
, have below code,
System.in.read();
when started this project, it will hold on. Then I will to access http://localhost:8081/configprops
, but show below message:
This webpage is not available
So how could access actuator endpoints in non-web application?
BTW why I want to do so, because when started my project it can't load yml data successfully and caused NPE. So I want to access /configprops
to check it.
My yml like this:
spring:
profiles.active: default
---
spring:
profiles: default
user:
foo:
aaa: aaa@foo.com
---
spring:
profiles: test
user:
foo:
aaa: aaa@foo.com
bbb: bbb@foo.com
@ConfigurationProperties(prefix="user", locations="user.yml")
public class UserConfig {
private HashMap<String, String> foo;
}