Class Profiles

java.lang.Object
org.springframework.boot.context.config.Profiles
All Implemented Interfaces:
Iterable<String>

public class Profiles extends Object implements Iterable<String>
Provides access to environment profiles that have either been set directly on the Environment or will be set based on configuration data property values.
Since:
2.4.0
Author:
Phillip Webb, Madhura Bhave
  • Field Details

    • INCLUDE_PROFILES_PROPERTY_NAME

      public static final String INCLUDE_PROFILES_PROPERTY_NAME
      Name of property to set to specify additionally included active profiles.
      See Also:
  • Method Details

    • iterator

      public Iterator<String> iterator()
      Return an iterator for all accepted profiles.
      Specified by:
      iterator in interface Iterable<String>
    • getActive

      public List<String> getActive()
      Return the active profiles.
      Returns:
      the active profiles
    • getDefault

      public List<String> getDefault()
      Return the default profiles.
      Returns:
      the active profiles
    • getAccepted

      public List<String> getAccepted()
      Return the accepted profiles.
      Returns:
      the accepted profiles
    • isAccepted

      public boolean isAccepted(String profile)
      Return if the given profile is active.
      Parameters:
      profile - the profile to test
      Returns:
      if the profile is active
    • toString

      public String toString()
      Overrides:
      toString in class Object