I want to dynamically configure the H2 database that comes with my spring boot application. All the examples I have seen talk about adding or changing the application.properties file.
What I want to do is something like this which is executed at boot time (hence dynamically):
// pseudo code
if environment variable or argument defined (ex: --h2.location = /tmp.foo.txt)
{
define url spring.datasource.url=jdbc:h2:file:<h2.location>
keep all other default values
}
else
{
use default spring.datasource.url (memory)
}