Module bus.setting

Class GlobalProfile

java.lang.Object
org.miaixz.bus.setting.magic.GlobalProfile

public class GlobalProfile extends Object
A global center for managing Profile configurations. It provides static access to a singleton Profile instance, allowing different parts of an application to retrieve profile-specific settings.
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • setProfile

      public static Profile setProfile(String profile)
      Sets the active global profile and returns the corresponding Profile instance. If an instance for this profile name already exists, it is returned; otherwise, a new one is created and cached.
      Parameters:
      profile - The name of the environment profile (e.g., "dev", "prod").
      Returns:
      The singleton Profile instance for the given profile name.
    • getSetting

      public static Setting getSetting(String settingName)
      Gets a Setting instance for the specified configuration file name under the currently active global profile.
      Parameters:
      settingName - The name of the configuration file (e.g., "db.setting").
      Returns:
      The Setting instance.