ConfIO
ConfIO is a lightweight, easy-to-use Java library for loading and parsing INI-style configuration files. It provides a universal parser with hierarchical and ordered sections (key-value, text, JSON), type-safe accessors, profile/environment overrides, comment handling, and optional hot-reload with listener notifications.
Features
- Universal INI-style parser with hierarchical and ordered sections.
- Key-value, TEXT and JSON section types; automatic detection or explicit via
__type__. - Typed access methods (String, Integer, Boolean, etc.) and iterator-based section access.
- Schema validation and support for custom validators; preserves comments and raw lines.
- Environment/profile overrides and hot-reload (watcher) with change notifications.
Requirements
- Java 17 or higher
- Maven 3.6+
Installation
<dependency>
<groupId>com.siperf</groupId>
<artifactId>confio</artifactId>
<version>0.3.0</version>
</dependency>
Quick start
import java.nio.file.Path;
import com.siperf.confio.*;
import com.siperf.confio.sections.*;
// Load configuration from file
ConfigurationFile config = ConfigurationFileLoader.load(Path.of("config.ini"));
// Get global parameters (general section)
String serverNumber = config.getGlobalParameter("server.number");
// Get a named section
if (config.hasSection("database")) {
KeyValueSection db = config.getSection("database", KeyValueSection.class);
String driver = db.getParameter("driver.classname");
boolean enabled = Boolean.parseBoolean(db.getParameter("enabled"));
}
License
- Licensed under Apache 2.0 — License