Eliminate reserved 'default' profile (SPR-7778)

There is no longer a reserved default profile named 'default'. Rather,
users must explicitly specify a default profile or profiles via

    ConfigurableEnvironment.setDefaultProfiles(String...)
        - or -
    spring.profile.default="pD1,pD2"

Per above, the setDefaultProfile(String) method now accepts a variable
number of profile names (one or more).  This is symmetrical with the
existing setActiveProfiles(String...) method.

A typical scenario might involve setting both a default profile as a
servlet context property in web.xml and then setting an active profile
when deploying to production.
This commit is contained in:
Chris Beams
2010-12-08 07:59:25 +00:00
parent e693d9fa58
commit b3e36a335d
8 changed files with 103 additions and 82 deletions

View File

@@ -84,13 +84,13 @@
TODO:SPR-7508: Document profile annotation:
* may be comma-delimited
* empty profile means beans will always be registered
* profile="default" means that beans will be registered unless other profile(s) are active
* profile="xyz,default" means that beans will be registered if 'xyz' is active or if no profile is active
* ConfigurableEnvironment.setDefaultProfileName(String) customizes the name of the default profile
* 'spring.profile.default' property customizes the name of the default profile (usually for use as a
* ConfigurableEnvironment.setActiveProfiles(String...) sets which profiles are active
* 'spring.profile.active' sets which profiles are active (typically as a -D system property)
servlet context/init param)
* ConfigurableEnvironment.setDefaultProfiles(String...) or 'spring.profile.default' property specifies one
or more default profiles, e.g., 'default'
* if 'default' is specified as a default profile, `profile="xyz,default"` means that beans will be
registered if 'xyz' is active or if no profile is active
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>