12.Profiles
Spring Profiles提供了一種隔離應用程序配置部分並使其僅在特定環境中可用的方法。
12.1添加活動配置文件
該spring.profiles.active屬性遵循與其他屬性相同的排序規則。這意味着您可以在application.properties中指定活動配置文件,然後使用命令行開關替換它們。
例如,當使用開關運行具有以下spring.profiles.active:development屬性的應用程序時,也會激活application-development.properties配置文件。
以下spring.profiles.active:production屬性,激活application-production.properties配置文件。
如有疑問,請觀看視頻:https://edu.csdn.net/course/detail/25550