Skip to content

Commit

Permalink
GH-862: expose all actuators via JMX for live hovers automatically wh…
Browse files Browse the repository at this point in the history
…en launching
  • Loading branch information
martinlippert committed Nov 7, 2022
1 parent c3f71e5 commit 1e9cb99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void setupEnvVars() throws Exception {
+ "-Dcom.sun.management.jmxremote.rmi.port=1234 "
+ "-Djava.rmi.server.hostname=localhost "
+ "-Dcom.sun.management.jmxremote.local.only=false "
+ "-Dspring.jmx.enabled=true",
+ "-Dspring.jmx.enabled=true"
+ "-Dmanagement.endpoints.jmx.exposure.include=*",
env.get("JAVA_OPTS"));

jmx.setupEnvVars(env); // should erase old and recreate
Expand All @@ -61,7 +62,8 @@ public void setupEnvVars() throws Exception {
+ "-Dcom.sun.management.jmxremote.rmi.port=1234 "
+ "-Djava.rmi.server.hostname=localhost "
+ "-Dcom.sun.management.jmxremote.local.only=false "
+ "-Dspring.jmx.enabled=true",
+ "-Dspring.jmx.enabled=true"
+ "-Dmanagement.endpoints.jmx.exposure.include=*",
env.get("JAVA_OPTS"));
}

Expand All @@ -84,7 +86,8 @@ public void setupEnvVars_preserve_unrelated_java_opts() throws Exception {
+ "-Dcom.sun.management.jmxremote.rmi.port=1234 "
+ "-Djava.rmi.server.hostname=localhost "
+ "-Dcom.sun.management.jmxremote.local.only=false "
+ "-Dspring.jmx.enabled=true",
+ "-Dspring.jmx.enabled=true"
+ "-Dmanagement.endpoints.jmx.exposure.include=*",
env.get("JAVA_OPTS"));

jmx.setupEnvVars(env); // should erase old and recreate
Expand All @@ -95,7 +98,8 @@ public void setupEnvVars_preserve_unrelated_java_opts() throws Exception {
+ "-Dcom.sun.management.jmxremote.rmi.port=1234 "
+ "-Djava.rmi.server.hostname=localhost "
+ "-Dcom.sun.management.jmxremote.local.only=false "
+ "-Dspring.jmx.enabled=true",
+ "-Dspring.jmx.enabled=true"
+ "-Dmanagement.endpoints.jmx.exposure.include=*",
env.get("JAVA_OPTS"));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,17 @@ public static String[] enableJmxArgs(String jmxPort) {
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Djava.rmi.server.hostname=localhost",
//
// PT 164402781 - For Boot 2.2 and above, jmx is no longer enabled by default.
// We explicitly enable it here. Adding this doesn't seem to affect older boot versions
// and we get live information from JMX for those too.
"-Dspring.jmx.enabled=true"
//
"-Dspring.jmx.enabled=true",
//
// GH-862: Spring Boot 3 doesn't expose all actuators over JMX anymore by default
// therefore we need to set this for live hovers here
//
"-Dmanagement.endpoints.jmx.exposure.include=*"
};
}

Expand Down

0 comments on commit 1e9cb99

Please sign in to comment.