How to access actuator endpoints in a non-web application

This is not a web project, but I still add spring-boot-starter-actuatorto pom and ask management.port=8081, and then in the last run method CommandLineRunnerthey have the code below

System.in.read();

when you start this project, it will continue. I will then access http://localhost:8081/configprops, but show the following message:

This webpage is not available

So, how can you access the actuator endpoints in a non-web application? By the way, why do I want to do this, because when I started my project, it was not able to successfully load the yml data and called NPE. So I want to access /configpropsto check it out.

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;    
}
+4
source share
2 answers

@dunni MBeans jconsole,

enter image description here

getData, ,

userConfig={prefix=user, properties={foo=null}}
+1

Source: https://habr.com/ru/post/1622337/


All Articles