When we start a Spring Boot server, there is always a startup message similar to the following:
Starting MyServerApplication on xxx with PID 1234
In this case, from where the value xxx
is extracted? And how can I change it?
I ask this question because this xxx
refers to an old app name that was later changed. However, I cannot find such a value anywhere in the code. That old name is not in any Java class, in any packages, in any xml or other configuration file known to me. I can't even find it by searching with a command similar to the following:
egrep -ir --include=* "xxx" .
Obviously xxx
is just an example. My question applies to any other name logged at Spring Boot starting.
CodePudding user response:
The xxx is the hostname of the machine where the application is running. To change the name, you'll need to change the hostname in the OS files. In Linux,
you can use sudo nano /etc/hostname
to change the hostname of your machine and restart the machine.
Hope this helps.