0

I have a tomcat server with several applications. Then, I gonna deploy spring boot application on tomcat. But before deploy I set an environment variable in my server. Because of This application should use the environment variable. So I wish not to restart my tomcat after set new environment variable in my server.

Have you any solution? Help me, please?

Nyamkhuu Buyanjargal
  • 621
  • 2
  • 11
  • 29
  • Environment variables normally cannot be changed for a running process. You should consider to use another mechanism like a properties file or a database. – Simon Martinelli Aug 08 '19 at 06:41

1 Answers1

1

You cannot change environment variables from Java without resorting to dirty tricks.

You can, however, change the values of system properties. Consider using system properties instead of environment variables to adjust the behavior of your application.

Better yet, don't use globally-visible/mutatable configuration and instead configure components individually through some other mechanism, such as a configuration file.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77