Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading