摘自
Environment注释:A profile is a named, logical group of bean definitions to be registered with the container only if the given profile is active. Beans may be assigned to a profile whether defined in XML or via annotations; see the spring-beans 3.1 schema or the
@Profileannotation for syntax details. The role of theEnvironmentobject with relation to profiles is in determining which profiles (if any) are currently active, and which profiles (if any) should be active by default.
profiles类似Maven中的profiles,Spring允许配置多个profile,但只加载激活的profile,通过profiles配置,可以实现不同环境使用不同的配置(例如不同环境使用不同的数据库配置)