From fdeb9fe73084bb138160668a8113d04bf34718db Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 12:19:08 +0100 Subject: [PATCH] GH-862: expose all actuators via JMX for live hovers automatically when launching --- .../vscode-spring-boot/lib/debug-config-provider.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts b/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts index 942b53295..4599476a6 100644 --- a/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts +++ b/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts @@ -6,6 +6,7 @@ import psList from 'ps-list'; import { ListenablePreferenceSetting } from "@pivotal-tools/commons-vscode/lib/launch-util"; const JMX_VM_ARG = '-Dspring.jmx.enabled=' +const ACTUATOR_JMX_EXPOSURE_ARG = '-Dmanagement.endpoints.jmx.exposure.include=' const ADMIN_VM_ARG = '-Dspring.application.admin.enabled=' const BOOT_PROJECT_ARG = '-Dspring.boot.project.name='; const RMI_HOSTNAME = '-Djava.rmi.server.hostname=localhost'; @@ -23,6 +24,9 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider { if (debugConfiguration.vmArgs.indexOf(JMX_VM_ARG) < 0) { debugConfiguration.vmArgs += ` ${JMX_VM_ARG}true`; } + if (debugConfiguration.vmArgs.indexOf(ACTUATOR_JMX_EXPOSURE_ARG) < 0) { + debugConfiguration.vmArgs += ` ${ACTUATOR_JMX_EXPOSURE_ARG}*`; + } if (debugConfiguration.vmArgs.indexOf(ADMIN_VM_ARG) < 0) { debugConfiguration.vmArgs += ` ${ADMIN_VM_ARG}true`; } @@ -33,7 +37,7 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider { debugConfiguration.vmArgs += ` ${RMI_HOSTNAME}`; } } else { - debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`; + debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ACTUATOR_JMX_EXPOSURE_ARG}* ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`; } } return debugConfiguration;