其他分享
首页 > 其他分享> > @ConfigurationProperties vs. @Value

@ConfigurationProperties vs. @Value

作者:互联网

@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.

标签:SpEL,Value,ConfigurationProperties,vs,property,your
来源: https://www.cnblogs.com/chengmuyu/p/15302364.html