java.lang.Object
org.miaixz.bus.setting.magic.GlobalProfile
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 Summary
Modifier and TypeMethodDescriptionstatic SettinggetSetting(String settingName) Gets aSettinginstance for the specified configuration file name under the currently active global profile.static ProfilesetProfile(String profile) Sets the active global profile and returns the correspondingProfileinstance.
-
Method Details
-
setProfile
Sets the active global profile and returns the correspondingProfileinstance. 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
Profileinstance for the given profile name.
-
getSetting
Gets aSettinginstance 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
Settinginstance.
-