由于您不再希望使用弹簧轮廓,因此在中只需每个键有1个即可
application.yml。从您的示例中得出,它看起来可能像这样:
environment: property1: @property1@ property2: @property2@
然后在您的
pom.xml或
settings.xml
<profiles> <profile> <id>dev</id> <properties> <property1>AAA</property1> <property2>BBB</property2> </properties> </profile> <profile> <id>prod</id> <properties> <property1>CCC</property1> <property2>DDD</property2> </properties> </profile></profiles>
在我的应用程序类中像这样使用:
@Value("${environment.property1}")private String profileProperty;@Value("${environment.property2}")private String settingsProperty;


