gpt4 book ai didi

java - spring中通过@propertysource注解加载属性文件和使用PropertySourcesHolderConfigure bean加载属性文件有什么区别

转载 作者:太空宇宙 更新时间:2023-11-04 10:09:08 25 4
gpt4 key购买 nike

我正在研究如何在 Spring 中访问属性文件,我很困惑如何找出 <context:property-placeholder> 之间的区别与 PropertySourcesPlaceHoderConfigure@PropertySourcePropertyPlaceHolderConfigure .

最佳答案

来自PropertySourcesPlaceholderConfigurer docs

PropertySourcesPlaceholderConfigurer 更加灵活,可以与Environment 和PropertySource 进行交互。它可以是本地属性或系统属性或环境变量。

Specialization of PlaceholderConfigurerSupport that resolves ${...} placeholders within bean definition property values and @Value annotations against the current Spring Environment and its set of PropertySources.

关于java - spring中通过@propertysource注解加载属性文件和使用PropertySourcesHolderConfigure bean加载属性文件有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52548960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com