sunmingtao / sample-code

3 stars 4 forks source link

Spring inject Resource not on classpath: File Not Found Exception #20

Closed sunmingtao closed 5 years ago

sunmingtao commented 5 years ago
@Value("${keycloak.config.file}")
private Resource resourceFile;

VM argument: -Dkeycloak.config.file=/Users/msun/keycloak-local.json

sunmingtao commented 5 years ago

If the file is not on classpath, it needs to be prefixed with "file:", so... -Dkeycloak.config.file=file:/Users/msun/keycloak-local.json