I have simple spring job with schedule annotation. Is there some way how to determine on which server it runs? We use Tomcat as web server.
Asked
Active
Viewed 292 times
0
-
1e.g. by using Spring evironment: https://stackoverflow.com/questions/38916213/how-to-get-the-spring-boot-host-and-port-address-during-run-time – Marc Stroebel Jul 30 '20 at 11:40
-
Unfortunatelly it dont return hostname but ip address, which I dont need. – Petr Kostroun Jul 30 '20 at 12:11
-
2take the ip, create an InetAddress and use InetAddress.getHostName() – Marc Stroebel Jul 30 '20 at 12:22