Home > Blockchain >  How to set spring property to a null value from an environment variable
How to set spring property to a null value from an environment variable

Time:09-08

Spring properties can be bound from environment variables: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables

I've tried various forms of null, NULL, #{null} but always end up with failed to convert java.lang.String to java.time.Duration (caused by java.lang.IllegalArgumentException: 'null' is not a valid duration)

How does one set a null value from an environment variable?

CodePudding user response:

You cannot set a null value from an environment variable (or any other property source). This Spring Boot issue is tracking adding support for binding null values.

  • Related