When you pass any parameters from the script, you can get this at runtime:
private String jmxRemote = System.getProperty("com.sun.management.jmxremote");
private String jmxRemotePort = System.getProperty("com.sun.management.jmxremote.port");
Get properties either the JVM itself or any -D options you may have
passed at the command line
Get ip:
// for example 127.0.0.1 is localhost ip
private String ip = InetAddress.getLoopbackAddress().getHostAddress();
Get port:
@Value("${local.server.port}")
private int serverPort;
or by:
@LocalServerPort
private int serverPort;
or by:
@Autowired
private Environment environment;
public void doWork(){
String serverPort = environment.getProperty("local.server.port");
// do something
}
Also you can get all properties from Environment - JVM / system / environment / all passed arguments