Home > OS >  Spring-boot Configuring properties with dash/hyphen using environment variables
Spring-boot Configuring properties with dash/hyphen using environment variables

Time:12-14

One of my favorite spring-boot feature is the ability to configure most things using the unix environment variables. Now I'm struggling with ActiveMQ broker config.

To set the broker url I have to specify spring.activemq.broker-url. Rewritten in envrionment terms this would be SPRING_ACTIVEMQ_BROKER-URL which is working from eclipse, but not possible to be defined as environment variable in any unix shell.

using env is due to other restrictions not an option

Is there something I missed or do I have to remap those "dashed" properties in an own @PropertiesConfiguration

Any hints ?

CodePudding user response:

Take a look at the documentation on relaxed binding.

The key in your application.properties or application.yml file will be spring.activemq.broker-url and your env var will be SPRING_ACTIVEMQ_BROKER_URL.

  • Related