我想用Spring (而不是Springboot)编写一个简单的项目,学习如何使用@profile注释加载基于环境的属性。几乎在任何地方,我只在Springboot中看到的示例(、)。我想知道我们是否不能编写一个能够基于环境(dev,prod)动态加载属性的Spring应用程序。
一些示例( 、、)使用@Profile显示,但这些示例为每个环境硬编码了bean细节,如下所示。devProdCcnnection() { System.out.println("DB Connection for Prod");返回"DB Con
我无法在Spring应用程序中动态激活配置文件。(Do not use @ for indentation) active: @activatedProperties@好像配置文件不被识别一样。下面是配置文件:@EnableConfigurationPropertiespublic class AppConfigurati