dawdler-util
Module introduction
Common utility classes, generally not exposed to developers.
1. Add the dependency to the pom
<groupId>club.dawdler</groupId>
<artifactId>dawdler-util</artifactId>
2. System properties
The framework's unified entry point for reading dawdler.* system properties is club.dawdler.util.DawdlerConfig; the precedence is: JVM startup parameter (-D) > environment variable (with the key mapped, e.g. dawdler.max.frame.length → DAWDLER_MAX_FRAME_LENGTH) > the top-level properties: section of dawdler-config.yml (supporting profiles / configuration center fallback / ${} placeholders / ENC() encryption) > code default value. For all configuration items, see the dawdler.* configuration reference.
2.1 Global default date/time formats (DateUtil)
The default formats of DateUtil can be overridden through JVM startup parameters (-D), affecting all date parsing and formatting that uses the default formats (such as time-type parameter binding on the web side):
| Property name | Default value |
|---|---|
dawdler.datetime.format | yyyy-MM-dd HH:mm:ss |
dawdler.date.format | yyyy-MM-dd |
dawdler.time.format | HH:mm:ss |
-Ddawdler.datetime.format=yyyy/MM/dd HH:mm:ss
2.2 Configuration placeholder resolution (SystemVariableUtil)
Configuration files support ${placeholder} placeholders; the resolution precedence is: system property (-D) > OS environment variable; default values using the ${key:defaultValue} syntax are supported:
host=${HOST_NAME:localhost}
port=${SERVER_PORT:8080}
2.3 Environment variables
| Variable name | Description |
|---|---|
DAWDLER_ENCRYPT_FILE | Path of the key file (dawdler.password) for decrypting configuration contents, used at runtime to decrypt encrypted configuration; for detailed usage see dawdler-encrypt-generator |
3. Third-party code notice
This module contains source code ported and adapted from third-party projects, all retaining the upstream copyright notices; see NOTICE in the repository root for the complete list:
| Package/class | Source | License |
|---|---|---|
club.dawdler.util.reflectasm (MethodAccess, FieldAccess, ConstructorAccess, AccessClassLoader, PublicConstructorAccess) | ReflectASM, modified version | BSD-3-Clause; the full text is in LICENSE-ReflectASM.txt, and it is also shipped with the jar as META-INF/LICENSE-ReflectASM.txt |
club.dawdler.util.spring (including the antpath subpackage) | MediaType/MimeType, AntPathMatcher, and the resource abstraction of Spring Framework | Apache-2.0 |
club.dawdler.util.HashedWheelTimer | Netty | Apache-2.0 |
AccessPolicy, MethodFingerprint, and ParameterNameReader in the club.dawdler.util.reflectasm package are original classes of this repository and contain no third-party code.