spring boot如何使用profiles.active分区配置

2024-11-10 01:14:36

1、新建springboot工程不说了,之前的经验都有,新建完成之后如图:

spring boot如何使用profiles.active分区配置

3、至于哪个具体的配置文件会被加载,需要在application.properties文件中通过spring.profiles.active属性来设置,其值对应{profile}值。如:spring.profiles.active=test就会加载application-test.properties配置文件内容:如图:

spring boot如何使用profiles.active分区配置
猜你喜欢