Springboot读取配置取消强制配置的方式

行走于代码中 / 2023-04-27 / 原文

Springboot读取配置时,有时不需要必须配置值,

//增加冒号,即使没有配置user.name,依然可以正常启动
@Value("\${user.name:}")