As described in the Spring Boot documentation, configuration can be passed via environment variables. However there are some configuration properties like spring.datasource.driver-class-name which contain hyphens. When setting this in bash you will get an error:
$ export SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
bash: export: `SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver': not a valid identifier
This is because variables in bash must not contain hyphens. So is it even possible to set Spring configuration properties which contain hyphens via environment variables?
Spring Boot provides a relaxed binding. For this reason the environment variable SPRING_DATASOURCE_DRIVER_CLASS_NAME can be used to set the driver class name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With