I don't get an answer in stackoverflow, so I post here my question: http://stackoverflow.com/questions/34041197/how-to-define-default-null-value-in-application-yml-in-spring-boot
Comment From: snicoll
The question on Stack Overflow is still open so there's no need for this issue. Thanks.
Comment From: gdespres
There is still no answer to this problem on stackoverflow.com, do you have a solution to be able to specify the null value to a property?
ex : my.property=${null}
Comment From: haridaniel
You can set to null in porperty file (i don't know yaml) by:
some.property=#{null}
or at java side by:
@Value("${some.property:#{null}}")
https://stackoverflow.com/a/17470732/1386911
Comment From: candrews
You can set to null in porperty file (i don't know yaml) by: some.property=#{null}
or at java side by: @value("${some.property:#{null}}")
https://stackoverflow.com/a/17470732/1386911
That doesn't work. Spring doesn't evaluate SpEL in properties files: https://github.com/spring-projects/spring-boot/issues/1672
As far as I can tell, there is no way to specify a null value in application.properties or application.yml (in yaml, that seems to be a bug though, and no by design - see https://jira.spring.io/browse/SPR-15425 )
Comment From: EhudLevy
Hi, you need to set it like that:
some:
property: '#{null}'
Comment From: Betlista
Hi, you need to set it like that:
some: property: '#{null}'
That's wrong - there will be "#{null}" value in String...
Comment From: incodemode
is there any update onto how to seta null value on application.yaml?
Comment From: wilkinsona
@incodemode It isn't possible. Please see https://github.com/spring-projects/spring-framework/issues/19986 for details.
Comment From: nazarovctrl
You can set to null in porperty file (i don't know yaml) by:
some.property=#{null}or at java side by:
@Value("${some.property:#{null}}")https://stackoverflow.com/a/17470732/1386911
Thank you