Class ApplicationProperties
java.lang.Object
io.fluxcapacitor.javaclient.configuration.ApplicationProperties
Central utility for resolving configuration properties within a Flux application.
This class delegates to a layered PropertySource
, typically obtained from the active
FluxCapacitor
instance. If no context-bound property source is present, it falls
back to a DecryptingPropertySource
that wraps the default layered DefaultPropertySource
.
Property sources are accessed in a prioritized order:
EnvironmentVariablesSource
– highest precedenceSystemPropertiesSource
ApplicationEnvironmentPropertiesSource
– e.g. application-dev.propertiesApplicationPropertiesSource
– fallback base configuration from application.properties
Property resolution supports typed access, default values, encryption, and template substitution.
Common usage:
String token = ApplicationProperties.getProperty("FLUX_API_TOKEN");
boolean featureEnabled = ApplicationProperties.getBooleanProperty("my.feature.enabled", true);
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsProperty
(String name) Returnstrue
if a property with the given name exists.static String
decryptValue
(String encryptedValue) Decrypts the given encrypted value using the configuredEncryption
strategy.static String
encryptValue
(String value) Encrypts the given value using the configuredEncryption
strategy.static boolean
getBooleanProperty
(String name) Resolves a boolean property by key, returningfalse
if not present.static boolean
getBooleanProperty
(String name, boolean defaultValue) Resolves a boolean property by key, returning a default if the property is not present.static Encryption
Returns the currently activeEncryption
instance.static Integer
getIntegerProperty
(String name) Resolves an integer property by key, ornull
if not found.static Integer
getIntegerProperty
(String name, Integer defaultValue) Resolves an integer property by key, or returns the given default value if not found.static String
getProperty
(String name) Returns the raw string property for the given key, ornull
if not found.static String
getProperty
(String name, String defaultValue) Returns the string property value for the given key, or the specified default if not found.static String
requireProperty
(String name) Returns the string property for the given key, throwing anIllegalStateException
if not found.static String
substituteProperties
(String template) Substitutes placeholders in the given template using current property values.
-
Constructor Details
-
ApplicationProperties
public ApplicationProperties()
-
-
Method Details
-
getProperty
Returns the raw string property for the given key, ornull
if not found. -
getBooleanProperty
Resolves a boolean property by key, returningfalse
if not present.Accepts case-insensitive "true" as
true
, otherwise returnsfalse
. -
getBooleanProperty
Resolves a boolean property by key, returning a default if the property is not present. -
getIntegerProperty
Resolves an integer property by key, ornull
if not found.- Throws:
NumberFormatException
- if the property value is not a valid integer
-
getIntegerProperty
Resolves an integer property by key, or returns the given default value if not found.- Throws:
NumberFormatException
- if the property value is not a valid integer
-
getProperty
Returns the string property value for the given key, or the specified default if not found. -
requireProperty
Returns the string property for the given key, throwing anIllegalStateException
if not found. -
containsProperty
Returnstrue
if a property with the given name exists. -
substituteProperties
Substitutes placeholders in the given template using current property values.Placeholders use the syntax
${propertyName}
. -
getEncryption
Returns the currently activeEncryption
instance.By default, wraps the encryption from the current
PropertySource
. -
encryptValue
Encrypts the given value using the configuredEncryption
strategy. -
decryptValue
Decrypts the given encrypted value using the configuredEncryption
strategy.Returns the original value if decryption is not applicable.
-