Created
December 10, 2019 18:17
-
-
Save cenkc/b29d0e63d1ab35fb81e9c8f0b28291a1 to your computer and use it in GitHub Desktop.
remote debugging and command line parameter usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
to run | |
/.../java/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4423 -jar /tmp/some-test-0.0.1-SNAPSHOT.jar --xip=192.168.1.1 --xport=11111 | |
*/ | |
@Component | |
public class SomeWorker implements ApplicationRunner { | |
public static final Logger logger = LoggerFactory.getLogger(SomeWorker.class); | |
@Value("${xip}") | |
private String xip; | |
@Value("${xport}") | |
private String xport; | |
@Override | |
public void run(ApplicationArguments args) throws Exception { | |
logger.debug("received=" + xip + ":" + xport); | |
String url = "http://192.168.1.2:8080/someapi/ip/%XIP%/port/%XPORT%"; | |
url = url.replaceFirst("%XIP%", xip).replaceFirst("%XPORT%", xport); | |
logger.debug("url:" + url); | |
/* | |
do some stuff | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment