@Value设置默认值

上一章章节目录下一章 2018-08-10已有4573人阅读 评论(0)
org.springframework.beans.factory.annotation.Value的@Value的默认值如何设置呢?

解决方法:

默认值方法@Value("${enableRedis:false}")


application.xml中:

enableRedis: true


代码注入enableRedis:

@Value("${bxCustomerProps.enableRedis:false}")
public void setEnableRedis(boolean isEnableRedis) {
enableRedis = isEnableRedis;
}

本文链接:http://www.yayihouse.com/yayishuwu/chapter/1465

向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交