添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
憨厚的烈酒  ·  golang处理json转义符 ...·  5 月前    · 
傲视众生的白开水  ·  pywinauto-CSDN博客·  1 年前    · 
好帅的签字笔  ·  ios 通知权限判断-掘金·  1 年前    · 
孤独的钢笔  ·  HTML5 新元素 | 菜鸟教程·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to set variiable throw SpEL in spring boot application:

@Value("${data.jndi-name:#{null}}")
private String jndiDataSource;

data.jndi-name should comes from application-{profile}.properties. But field jndiDataSource always null even if data.jndi-name exists.

Code with @Value("${data.jndi-name}") work fine but jndiDataSource contains empty string.

My question is how to set null to variable if property does not exists using SpEL.

upd: values comes from profile specific property file

This work well only when data comes from main application.properties. When data comes from profile profile specific property it's not work – theSemenov Aug 22, 2018 at 5:02

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.