setx
setx
adds the variable but doesn't make it available in the current shell (as explained here):
setx modifies the value permenantly, which affects all future shells,
but does not modify the environment of the shells already running. You
have to exit the shell and reopen it before the change will be
available, but the value will remain modified until you change it
again.
Just make sure you are runnning from a newly opened shell window.
I suggest you use set spring.cloud.config.uri=http://example.com:8888
just for the sake of testing.
Check if the environment variable is present
You may add the following as the very first line your main
method:
System.out.println(System.getenv("spring.cloud.config.uri"));
System.out.println(System.getenv("SPRING_CLOUD_CONFIG_URI"));
Variable name with underscore
Windows supports environment variables with dots, so it should be ok for you. This isnt the case for pretty much all the other OS. Just so you know, spring supports variable name with underscores (as explained in the link you provided):
If you use environment variables rather than system properties, most
operating systems disallow period-separated key names, but you can use
underscores instead (e.g. SPRING_CONFIG_NAME instead of
spring.config.name).