PropertySourceLocator
发布日期:2021-06-30 14:53:57
浏览次数:2
分类:技术文章
本文共 1528 字,大约阅读时间需要 5 分钟。
TestPropertySourceLocator
import org.springframework.cloud.bootstrap.config.PropertySourceLocator;import org.springframework.core.env.CompositePropertySource;import org.springframework.core.env.Environment;import org.springframework.core.env.PropertySource;/** * @author jerryjin */public class TestPropertySourceLocator implements PropertySourceLocator { private static final String INSPECTION_PROPERTY_SOURCE_NAME ="BCZN_INSPECTION"; @Override public PropertySource locate(Environment environment) { CompositePropertySource composite = new CompositePropertySource(INSPECTION_PROPERTY_SOURCE_NAME); System.out.println("==========================================================="); System.out.println(environment.resolveRequiredPlaceholders("${hero.name:}")); System.out.println("==========================================================="); // composite. return composite; }}
TestSourceLocatorConfig
import com.jerry.inspection.listener.TestPropertySourceLocator;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;/** * @author jerryjin */@Configurationpublic class TestSourceLocatorConfig { @Bean public TestPropertySourceLocator inspectionPropertySourceLocator(){ return new TestPropertySourceLocator(); } }
src/main/resources/META-INF/spring.factories
org.springframework.cloud.bootstrap.BootstrapConfiguration=\com.jerry.inspection.config.TestSourceLocatorConfig
转载地址:https://jerryjin.blog.csdn.net/article/details/114323239 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
表示我来过!
[***.240.166.169]2024年04月25日 16时15分51秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
解释区块链钱包的意思
2019-05-01
让老百姓知道什么是比特币,只需要10分钟
2019-05-01
为什么要反对比特币,这不代表是空气币
2019-05-01
5G技术如何运用在数字资产方面
2019-05-01
区块链技术运用最广泛的还是保险
2019-05-01
我们提出了DeFi项目如何成为聚合器,有两种路径
2019-05-01
SnapEx的新感觉,对新手很友好
2019-05-01
区块链有哪些潜在风险?
2019-05-01
聚合器运用在什么地方最合适
2019-05-01
区块链可以解决供应链的问题,包括食品方面
2019-05-01
首个聚合器怎么产生的,并运用领域在什么
2019-05-01
区块链资金安全吗?该怎么保护
2019-05-01
区块链的优势和劣势的对比
2019-05-01
新技术,区块链能用在什么领域
2019-05-01
区块链技术应用,最先医疗行业
2019-05-01
新币上市旧币会降价吗
2019-05-01
为什么币圈的基础设施越来越多
2019-05-01
区块链投资要注意这几点
2019-05-01
市场套利策略是什么
2019-05-01
跨市场套利怎么处理
2019-05-01