I could set the default property value to an empty...
# spring
f
I could set the default property value to an empty String as the example under, but still not quite optimal.
Copy code
@Value("\${email.address.override:}")
m
if u could set
:default
then there is no need for
String? = null
btw:
@Value
is very good to wire with constructor. Is there a reason why u don't use this way?
Copy code
@Service
class FileService(
@Autowired val storage: Storage,
@Value("\${files-topic:default-topic}") val filesTopic: String
) {}
f
Thanks @mp! Is there any way to set the default value to null? If i use :null i actually get the String "null" instead of NULL
pls reply will it works for you or not - cos I`m also interesting in that
f
@mp you can write it like this:
Copy code
@Value("\${email.address.override:#{null}}")
in order to set the default to null
It worked 🙂
m
tnx