Browse Source

Merge branch '6.0.x'

pull/31518/head
Stéphane Nicoll 1 year ago
parent
commit
6585f1a208
  1. 5
      framework-docs/modules/ROOT/pages/core/beans/environment.adoc
  2. 10
      spring-context/src/main/java/org/springframework/context/annotation/Profile.java
  3. 2
      spring-core/src/main/java/org/springframework/core/env/AbstractEnvironment.java

5
framework-docs/modules/ROOT/pages/core/beans/environment.adoc

@ -562,8 +562,9 @@ If no profile is active, the `dataSource` is created. You can see this @@ -562,8 +562,9 @@ If no profile is active, the `dataSource` is created. You can see this
as a way to provide a default definition for one or more beans. If any
profile is enabled, the default profile does not apply.
You can change the name of the default profile by using `setDefaultProfiles()` on
the `Environment` or, declaratively, by using the `spring.profiles.default` property.
The name of the default profile is `default`. You can change the name of
the default profile by using `setDefaultProfiles()` on the `Environment` or,
declaratively, by using the `spring.profiles.default` property.

10
spring-context/src/main/java/org/springframework/context/annotation/Profile.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -38,6 +38,14 @@ import org.springframework.core.env.Profiles; @@ -38,6 +38,14 @@ import org.springframework.core.env.Profiles;
* for web applications. Profiles may also be activated declaratively in
* integration tests via the {@code @ActiveProfiles} annotation.
*
* <p>If no profile is active using one of those options, a default profile is
* enabled as a fallback. The name of the default profile is
* {@value AbstractEnvironment#RESERVED_DEFAULT_PROFILE_NAME}. This can be changed
* via {@link ConfigurableEnvironment#setDefaultProfiles} or declaratively by
* setting the {@link AbstractEnvironment#DEFAULT_PROFILES_PROPERTY_NAME
* spring.profiles.default} property as a JVM system property, as an environment
* variable, or as a Servlet context parameter in {@code web.xml} for web applications.
*
* <p>The {@code @Profile} annotation may be used in any of the following ways:
* <ul>
* <li>as a type-level annotation on any class directly or indirectly annotated with

2
spring-core/src/main/java/org/springframework/core/env/AbstractEnvironment.java vendored

@ -97,7 +97,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment { @@ -97,7 +97,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
* @see AbstractEnvironment#DEFAULT_PROFILES_PROPERTY_NAME
* @see AbstractEnvironment#ACTIVE_PROFILES_PROPERTY_NAME
*/
protected static final String RESERVED_DEFAULT_PROFILE_NAME = "default";
public static final String RESERVED_DEFAULT_PROFILE_NAME = "default";
protected final Log logger = LogFactory.getLog(getClass());

Loading…
Cancel
Save