首页 > 其他 > 详细

@ConfigurationProperties vs. @Value

时间:2021-09-17 15:33:31      阅读:20      评论:0      收藏:0      [点我收藏+]

@ConfigurationProperties vs. @Value

技术分享图片

If you define a set of configuration keys for your own components, we recommend you group them in a POJO annotated with @ConfigurationProperties. Doing so will provide you with structured, type-safe object that you can inject into your own beans.

SpEL expressions from application property files are not processed at time of parsing these files and populating the environment. However, it is possible to write a SpEL expression in @Value. If the value of a property from an application property file is a SpEL expression, it will be evaluated when consumed via @Value.

@ConfigurationProperties vs. @Value

原文:https://www.cnblogs.com/chengmuyu/p/15302364.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!