So I have a Userstorage SPI that connects to a DB. At the moment it is hard coded (db url, username, password, etc.) into the class and I would like to use an application.properties file near the jar.
So the keycloak folder structure should look something like:
keycloak:
bin
conf
data
lib
providers
my-userstorage-spi.jar
application.properties
So when the keycloak starts: bin/kc.bat start-dev, the my-userstorage-spi.jar should read the values from the application.properties.
I am up for any solution. Autoconfiguration, file handling...
For example if I try to use it like this, it would say the file is not found:
Properties mainProperties = new Properties();
String path = "./application.properties";
FileInputStream file = new FileInputStream(path);
mainProperties.load(file);
System.out.println(mainProperties.get("my.value"));
file.close();
The exception:
java.io.FileNotFoundException: .\application.properties (The system cannot find the file specified)
Thanks in advance.