我想用Spring (而不是Springboot)编写一个简单的项目,学习如何使用@profile注释加载基于环境的属性。几乎在任何地方,我只在Springboot中看到的示例(、)。我想知道我们是否不能编写一个能够基于环境(dev,prod)动态加载属性的Spring应用程序。
一些示例( 、、)使用@Profile显示,但这些示例为每个环境硬编码了bean细节,如下所示。devProdCcnnection() { System.out.println("DB Connection for Prod");返回"DB Con
from the propertyfile from githubbootstrap.yml:
spring: profiles: dev application: name: config-client cloud: config: uri: //配置服务器端口配置文件: sbx,dev,test,prod