-
Notifications
You must be signed in to change notification settings - Fork 14
Home
⚠️ Note: This wiki has been primarily generated and maintained using AI assistance. While we strive for accuracy, please report any errors or inconsistencies in the GitHub Issues.
Welcome to the comprehensive documentation for Okaeri Configs - a powerful, lightweight Java configuration library that makes working with configuration files simple and type-safe.
Okaeri Configs is a modern Java configuration library that allows you to use Java classes as configuration adapters. It provides a clean, annotation-based approach to managing application settings across multiple formats and platforms.
- 🎯 Type-Safe Configurations: Use Java classes with getters/setters for compile-time safety
- 💬 Comment Support: Add persistent comments and headers to your config files
- 🔄 Multiple Formats: YAML, JSON, HJSON, HOCON support out of the box
- 🎮 Platform Support: Special integrations for Bukkit, Bungee, and more
- 📦 Lightweight: Core library is only ~129kB
- ✅ Validation: Built-in validation support (Okaeri Validator, Jakarta EE)
- 🔌 Extensible: Custom serializers, transformers, and format support
- 🌍 Environment Variables: Built-in support for environment variable substitution
@Header("################################")
@Header("# My Application Config #")
@Header("################################")
public class AppConfig extends OkaeriConfig {
@Comment("Application settings")
private String appName = "MyApp";
private Integer maxConnections = 100;
@Variable("API_KEY")
@Comment("API key (can be set via environment variable)")
private String apiKey = "your-key-here";
@Comment("Server configuration")
private ServerConfig server = new ServerConfig();
public static class ServerConfig extends OkaeriConfig {
private String host = "localhost";
private Integer port = 8080;
}
}Usage:
AppConfig config = ConfigManager.create(AppConfig.class, (it) -> {
it.withConfigurer(new YamlSnakeYamlConfigurer());
it.withBindFile(new File("config.yml"));
it.saveDefaults();
it.load(true);
});
// Access with type safety
String appName = config.getAppName();
config.setMaxConnections(200);
config.save();- Getting Started - Installation, first config, basic concepts
- Configuration Basics - Understanding OkaeriConfig fundamentals
- Quick Start Examples - Common use cases and patterns
- Annotations Guide - @Header, @Comment, @Variable, and more
- Supported Types - What types can be used in configs
- Subconfigs & Serialization - Nested configurations
- Collections & Maps - Working with complex data structures
- Validation - Config validation with annotations
- Serdes Extensions - Custom serialization/deserialization
- Migrations - Updating configs between versions
- Advanced Topics - Custom serializers, transformers, post-processing
- Using Lombok - Reduce boilerplate with Project Lombok
- Troubleshooting - Common issues and solutions
- Examples & Recipes - Real-world usage patterns
Maven:
<repository>
<id>okaeri-repo</id>
<url>https://storehouse.okaeri.eu/repository/maven-public/</url>
</repository>
<dependency>
<groupId>eu.okaeri</groupId>
<artifactId>okaeri-configs-yaml-snakeyaml</artifactId>
<version>{VERSION}</version>
</dependency>Gradle (Kotlin DSL):
maven("https://storehouse.okaeri.eu/repository/maven-public/")
implementation("eu.okaeri:okaeri-configs-yaml-snakeyaml:{VERSION}")See Getting Started for detailed installation instructions.
| Use Case | Format | Additional Dependencies |
|---|---|---|
| Bukkit Plugins | YAML (Bukkit) |
okaeri-configs-yaml-bukkit + okaeri-configs-serdes-bukkit
|
| Bungee Plugins | YAML (Bungee) | okaeri-configs-yaml-bungee |
| General Purpose | YAML (SnakeYAML) | okaeri-configs-yaml-snakeyaml |
| Standalone Apps | HJSON (~193kB) |
okaeri-configs-hjson + okaeri-configs-validator-okaeri
|
| Format | Artifact ID | Notes |
|---|---|---|
| YAML (SnakeYAML) | okaeri-configs-yaml-snakeyaml |
General-purpose YAML. Good balance of features and compatibility. |
| YAML (Bukkit) | okaeri-configs-yaml-bukkit |
Uses Bukkit's built-in YAML library. Useful for Bukkit plugins. |
| YAML (Bungee) | okaeri-configs-yaml-bungee |
Uses BungeeCord's YAML library. Useful for Bungee plugins. |
| JSON (Gson) | okaeri-configs-json-gson |
Based on Google's Gson. No comment support. |
| JSON (Simple) | okaeri-configs-json-simple |
Based on json-simple. No indentation, no comments. |
| HJSON | okaeri-configs-hjson |
Human-friendly JSON. Supports comments. Recommended for standalone apps. |
| HOCON | okaeri-configs-hocon-lightbend |
Based on Lightbend Config. Limited comments/ordering. Not recommended. |
- 🐛 Bug Reports: GitHub Issues
- 💬 Discord: Join our Discord
- 📖 Source Code: GitHub Repository
- 📦 Maven Repository: Okaeri Storehouse
Found an error or want to improve the documentation?
- Visit the GitHub repository
- Navigate to the
.wiki/directory - Submit a pull request with your improvements
Ready to get started? Head over to Getting Started to create your first config!