Class ApplicationProperties
This class delegates to a layered PropertySource, typically obtained from the active
Fluxzero 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 precedenceSystemPropertiesSourceFluxzeroAdditionalPropertiesSource– extra locations declared withFLUXZERO_CONFIG_LOCATIONSApplicationEnvironmentPropertiesSource– e.g. application-dev.propertiesApplicationPropertiesSource– fallback base configuration from application.propertiesFluxzeroPropertiesSource– Fluxzero-specific SDK defaults from fluxzero.properties or fluxzero.json
Property resolution supports typed access, default values, encryption, and template substitution.
Common usage:
String token = ApplicationProperties.getProperty("FLUXZERO_API_TOKEN");
boolean featureEnabled = ApplicationProperties.getBooleanProperty("my.feature.enabled", true);
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringOptional version of the deployed application.static final StringOptional explicit unique client-instance ID.static final StringSelects the versioned Fluxzero default behavior profile for applications that do not configure each default explicitly.static final StringLegacy alias forCLIENT_ID_PROPERTY.static final StringLegacy alias forTASK_ID_PROPERTY.static final StringIdentity of the platform task that hosts the application. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsProperty(String name) Returnstrueif a property with the given name exists.static StringCreates a unique ID for a client instance.static StringcreateClientId(io.fluxzero.common.application.PropertySource propertySource) Creates a unique ID for a client instance from the given property source.static StringdecryptValue(String encryptedValue) Decrypts the given encrypted value using the configuredEncryptionstrategy.static booleandefaultsVersionAtLeast(io.fluxzero.common.application.PropertySource propertySource, LocalDate version) Returns whether the given source opts into behavior introduced on or before the given date.static booleandefaultsVersionAtLeast(LocalDate version) Returns whether the active defaults version opts into behavior introduced on or before the given date.static StringencryptValue(String value) Encrypts the given value using the configuredEncryptionstrategy.static booleangetBooleanProperty(String name) Resolves a boolean property by key, returningfalseif not present.static booleangetBooleanProperty(String name, boolean defaultValue) Resolves a boolean property by key, returning a default if the property is not present.static LocalDateReturns the active Fluxzero defaults version, ornullwhen compatibility defaults are used.static LocalDategetDefaultsVersion(io.fluxzero.common.application.PropertySource propertySource) Returns the Fluxzero defaults version from the given source, ornullwhen compatibility defaults are used.static io.fluxzero.common.encryption.EncryptionReturns the currently activeEncryptioninstance.static StringgetFirstAvailableProperty(String... propertyNames) Returns anOptionalcontaining the first non-null property value among the provided property names, if any exist.static IntegergetIntegerProperty(String name) Resolves an integer property by key, ornullif not found.static IntegergetIntegerProperty(String name, Integer defaultValue) Resolves an integer property by key, or returns the given default value if not found.static LonggetLongProperty(String name) Resolves a long property by key, ornullif not found.static LonggetLongProperty(String name, Long defaultValue) Resolves a long property by key, or returns the given default value if not found.static StringgetProperty(String name) Returns the raw string property for the given key, ornullif not found.static StringgetProperty(String name, String defaultValue) Returns the string property value for the given key, or the specified default if not found.static StringReturns the configured platform task ID, ornullwhen the application does not run as a known task.static StringgetTaskId(io.fluxzero.common.application.PropertySource propertySource) Returns the platform task ID from the given property source, ornullwhen absent or blank.static <T> TmapProperty(String name, Function<String, T> mapper) Maps a property value identified by its name to a desired type using the provided mapping function.static <T> TmapProperty(String name, Function<String, T> mapper, Supplier<T> defaultValueSupplier) Maps a property value identified by its name to a desired type using the provided mapping function.static StringrequireProperty(String name) Returns the string property for the given key, throwing anIllegalStateExceptionif not found.static StringsubstituteProperties(String template) Substitutes placeholders in the given template using current property values.static PropertiessubstituteProperties(Properties properties) Substitutes placeholders in the properties using current property values.
-
Field Details
-
TASK_ID_PROPERTY
Identity of the platform task that hosts the application. The default environment-variable name isFLUXZERO_TASK_ID;FLUX_TASK_IDremains supported as a legacy alias.- See Also:
-
LEGACY_TASK_ID_PROPERTY
-
CLIENT_ID_PROPERTY
Optional explicit unique client-instance ID. The default environment-variable name isFLUXZERO_CLIENT_ID;FLUX_CLIENT_IDremains supported as a legacy alias.- See Also:
-
LEGACY_CLIENT_ID_PROPERTY
-
APPLICATION_VERSION_PROPERTY
Optional version of the deployed application. When configured, Fluxzero adds the value to the correlation metadata of every outgoing message under$applicationVersion. The default environment-variable alias isFLUXZERO_APPLICATION_VERSION.- See Also:
-
DEFAULTS_VERSION_PROPERTY
Selects the versioned Fluxzero default behavior profile for applications that do not configure each default explicitly.Existing applications can omit this property to keep compatibility defaults. New applications can set a value in
yyyy.MM.ddformat to opt into all default changes introduced on or before that date. Each default can still be overridden by its own dedicated property.Versioned defaults Defaults version Equivalent property Behavior >= 2026.05.20fluxzero.tracking.unconfiguredHandlerConsumerMode = perHandlerHandlers without an explicit consumer get an isolated generated default consumer per handler class, instead of joining the shared application default consumer for the message type. >= 2026.05.21fluxzero.scheduling.periodic.useDefaultInitialDelay = true@Periodicschedules without an explicitinitialDelayuse their natural first deadline: fixed-delay schedules first run afterdelay, and cron schedules first run at the next cron match. UseinitialDelay = 0for an immediate first run.>= 2026.05.25fluxzero.cache.mode = adaptiveThe default aggregate cache uses a count-bounded hard-reference cache. Applications can keep the old behavior with fluxzero.cache.mode = softRef. Tracking caches are not changed by this defaults version and require an explicitfluxzero.tracking.cache.modesetting.>= 2026.06.09fluxzero.aggregate.commitPolicy = async_after_handler_await_after_batchAggregates using the default commit policy start their commits after each handler, keep active thread-local aggregates visible until batch completion, and wait for all started commits together at the end of the current message batch. Existing applications can keep the legacy behavior with fluxzero.aggregate.commitPolicy = sync_after_batch.>= 2026.06.20fluxzero.tracking.defaultHandlingMode.webrequest = asyncWeb request handlers assigned through default consumers are invoked on worker threads by default. Existing applications can keep synchronous handling with fluxzero.tracking.defaultHandlingMode.webrequest = syncor by configuring the web request default consumer withhandlingMode = SYNC.>= 2026.08.04fluxzero.auth.useUserIdMetadata = trueAbstractUserProviderwrites$systemfor the system user andPrincipal.getName()for regular users. It resolves$systemto the system user and other values throughgetUserById. Existing applications can keep serialized user objects withfluxzero.auth.useUserIdMetadata = false.>= 2026.08.26fluxzero.web.defaultRedirectPolicy = SAME_ORIGINOutbound web requests using RedirectPolicy.DEFAULTonly follow redirects within the original scheme, host, and effective port. Existing applications can retain normal JDK redirects withfluxzero.web.defaultRedirectPolicy = ALLOW;NEVERdisables redirects explicitly.Memory-aware cache pressure can be tuned with
fluxzero.cache.memoryPressure.heapThresholdPercent,fluxzero.cache.memoryPressure.gcTimeThresholdPercent, andfluxzero.cache.memoryPressure.trimRatioPercent. The amount evicted in a single pass is also capped byfluxzero.cache.memoryPressure.maxTrimWeight.- See Also:
-
-
Constructor Details
-
ApplicationProperties
public ApplicationProperties()
-
-
Method Details
-
getDefaultsVersion
Returns the active Fluxzero defaults version, ornullwhen compatibility defaults are used. -
getDefaultsVersion
public static LocalDate getDefaultsVersion(io.fluxzero.common.application.PropertySource propertySource) Returns the Fluxzero defaults version from the given source, ornullwhen compatibility defaults are used.- Throws:
IllegalArgumentException- ifDEFAULTS_VERSION_PROPERTYis not inyyyy.MM.ddformat
-
defaultsVersionAtLeast
Returns whether the active defaults version opts into behavior introduced on or before the given date. -
defaultsVersionAtLeast
public static boolean defaultsVersionAtLeast(io.fluxzero.common.application.PropertySource propertySource, LocalDate version) Returns whether the given source opts into behavior introduced on or before the given date. -
getProperty
-
mapProperty
-
mapProperty
public static <T> T mapProperty(String name, Function<String, T> mapper, Supplier<T> defaultValueSupplier) Maps a property value identified by its name to a desired type using the provided mapping function. If the property is not found, the method returns a default value supplied by the given supplier. -
getFirstAvailableProperty
-
getTaskId
Returns the configured platform task ID, ornullwhen the application does not run as a known task. -
getTaskId
Returns the platform task ID from the given property source, ornullwhen absent or blank. -
createClientId
Creates a unique ID for a client instance. An explicitly configuredFLUXZERO_CLIENT_IDis used when present. Otherwise, a random UUID is generated and prefixed withFLUXZERO_TASK_IDwhen available. Callers should create this ID once and retain it across reconnects. -
createClientId
Creates a unique ID for a client instance from the given property source. -
getBooleanProperty
Resolves a boolean property by key, returningfalseif 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, ornullif 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
-
getLongProperty
Resolves a long property by key, ornullif not found.- Throws:
NumberFormatException- if the property value is not a valid long
-
getLongProperty
Resolves a long property by key, or returns the given default value if not found.- Throws:
NumberFormatException- if the property value is not a valid long
-
getProperty
-
requireProperty
Returns the string property for the given key, throwing anIllegalStateExceptionif not found. -
containsProperty
Returnstrueif a property with the given name exists. -
substituteProperties
-
substituteProperties
Substitutes placeholders in the properties using current property values.Placeholders use the syntax
${propertyName}. -
getEncryption
public static io.fluxzero.common.encryption.Encryption getEncryption()Returns the currently activeEncryptioninstance.By default, wraps the encryption from the current
PropertySource. -
encryptValue
-
decryptValue
-