Reputation: 3742
In my spring boot example, I'd like to read environment variables
from my local machine(Win 7).
@Data
@Component
public class EnvironmentVariableSystemProperties {
@Value("${java.home}")
private String javaHome;
@Value("${DATASTORE.DATASET}")
private String datastoreDataset;
@Value("${SPRINGA}")
private String springConfigName;
}
It works well when reading java.home
and DATASTORE.DATASET
which have been added in my OS environment variables
before.
I just added a new variable SPRINGA
. When running spring boot example, I got the error:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'SPRINGA' in string value "${SPRINGA}".
Should I restart up my machine to make the variable work? I just restarted Eclipse, but it didn't work.
Upvotes: 2
Views: 6404
Reputation: 3742
Restarting Eclipse
with the Restart
in the Menu doesn't work.
Exiting Eclipse
and Running it again works.
How weird it is!
Upvotes: 5