其他分享
首页 > 其他分享> > 环境的激活

环境的激活

作者:互联网

@PropertySource

LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code and KPI, Keep progress,make a better result.
Survive during the day and develop at night。

目录

概 述

某种激活的软件,当前的软件被激活的,指定当前环境下才能被注册到容器中。
dev 环境被一个bean 都被环境标识的Bean,只有当环境被激活的时候的,标了defalut 测试环境。
@Test
运行程序的时候,使用命令行参数的时候激活的profile,测试数据源变成,动态数据源,在虚拟机参数加载。

创建一个applciation.getEnvroment.set 设置激活的环境,
注册主配置类。启动刷新容器。相当于代码的方式激活的环境,
@Profile(“test”)
只有配置类只有是指定的环境上,容器中没有标注的环境标识的bean 在任何环境上才能生效。
打印IOC容器的bean,激活测试环境,发现yellow,都会被加载的方法,

小结

参考资料和推荐阅读

1.链接: link.

标签:容器,forever,people,环境,bean,激活
来源: https://blog.csdn.net/xiamaocheng/article/details/122755478