Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

propify

> 编程语言
Open source

A lightweight Java annotation processor that generates type-safe Java code from configuration files (YAML/Properties)

198 stars0 likes1 views
WebsiteGitHub

About

A lightweight Java annotation processor that generates type-safe Java code from configuration files (YAML/Properties)

Propify


Propify is a Java annotation processor that generates typed APIs from configuration files (YAML, INI, .properties), i18n bundles, and schema definitions (JSON Schema, OpenAPI).

If a config key, message key, or schema shape changes, the generated API changes with it and mismatches show up during compilation rather than as runtime lookups.

It supports nested properties, custom lookup providers (env/system/custom), ICU4J message formatting, and schema-based POJO generation. Generated code is regular Java; you call it from your application code.


Table of Contents

  1. Why Propify?
  2. Features
  3. Requirements
  4. Installation
  5. Quick Start
  6. Internationalization (i18n)
  7. Schema-Based Generation
  8. How It Works
  9. Examples
  10. Documentation
    • @Propify Guide - Complete guide to type-safe configuration
    • @I18n Guide - Comprehensive internationalization guide
    • @SchemaGen Guide - Schema-based POJO generation guide
  11. Getting Help
  12. Contributing
  13. License
  14. Acknowledgments

Why Propify?

  • Typed access: use generated getters/methods instead of config.get("a.b.c")-style lookups.
  • Earlier failures: missing keys and invalid formats fail the build, not production.
  • Less glue code: no hand-written parsing/mapping for common cases.
  • Extensible resolution: plug in custom lookup providers for env vars, system properties, or your own sources.

Features

  • Type-safe config: generate APIs from YAML, INI, or .properties.
  • Type-safe i18n: generate resource bundle accessors; ICU4J MessageFormat support.
  • Schema-based POJOs: generate mutable DTOs from JSON Schema or OpenAPI specs.
  • Compile-time validation: syntax and schema checks happen during the build.
  • Nested keys: hierarchical configs map to nested types.
  • Custom lookups: resolve values from env/system/custom providers.
  • Compile-time generation: no runtime parsing step required for the generated accessors.

Requirements

  • Java: 8 or higher
  • Build: Maven or Gradle

Installation

Maven

Add dependency and annotation processor:

xml

  
    com.vgerbot
    propify
    3.0.0
  

  
    
      maven-compiler-plugin
      3.8.1
      
        1.8
        1.8
        
          
            com.vgerbot
            propify
            3.0.0
          
        
      
    
  

Gradle (≥4.6)

groovy
dependencies {
  implementation 'com.vgerbot:propify:3.0.0'
  annotationProcessor 'com.vgerbot:propify:3.0.0'
}

Gradle ( For other tools, configure your build to include propify as an annotation processor.


Quick Start

  1. Create src/main/resources/application.yml:

    yaml
    server:
      host: localhost
      port: 8080
    database:
      url: jdbc:mysql://localhost:3306/mydb
      username: root
      password: secret
  2. Annotate an interface:

    java
    @Propify(location = "application.yml")
    public interface AppConfig {}
  3. Use the generated API:

    java
    public class Main {
      public static void main(String[] args) {
        AppConfigPropify cfg = AppConfigPropify.getInstance();
        System.out.println(cfg.getServer().getHost());
        System.out.println(cfg.getDatabase().getUrl());
      }
    }

Full @Propify Documentation - Learn about custom lookups, media types, advanced configuration options, and more.


Internationalization (i18n)

Generate type-safe resource bundles using ICU4J:

  1. Create message files in resources/:

    properties
    # messages.properties (default)
    welcome=Welcome
    greeting=Hello, {0}!
    
    # messages_zh_CN.properties
    welcome=欢迎
    greeting=你好, {0}!
  2. Annotate a class:

    java
    @I18n(baseName = "messages", defaultLocale = "en")
    public class Messages {}
  3. Access messages:

    java
    String hi = MessageResource.getDefault().greeting("Alice");
    String hiZh = MessageResource.get(Locale.CHINESE).greeting("张三");

Full @I18n Documentation - Explore ICU MessageFormat, pluralization, date/time formatting, and multi-locale support.


Schema-Based Generation

Generate mutable POJO/DTO classes from schema definitions for REST APIs and data modeling:

Quick Example

java
// 1. Create a JSON Schema or OpenAPI spec
@SchemaGen(location = "schemas/user.schema.json")
public interface UserSchema {}

// 2. Use the generated POJO
User user = User.builder()
    .username("johndoe")
    .email("[email protected]")
    .build();

// 3. Serialize/deserialize with Jackson
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(user);
User deserializedUser = mapper.readValue(json, User.class);

Key points:

  • Mutable POJOs with getters/setters
  • Builder pattern for fluent construction
  • Optional Jackson annotations for JSON serialization
  • Optional Bean Validation annotations (@NotNull, @Email, @Size, etc.)
  • JSON Schema and OpenAPI 3.x inputs

Full @SchemaGen Documentation - Learn about OpenAPI support, type mapping, validation annotations, and more.


How It Works

  1. Scan for @Propify, @I18n, and @SchemaGen annotations
  2. Parse configuration files, message bundles, and schema definitions
  3. Generate Java implementation classes and POJOs
  4. Compile everything together—fail-fast on errors

Examples

Check the example/ directory for complete working examples:

  • Basic Configuration - Simple YAML/Properties configuration
  • Advanced Configuration - Custom lookups and nested structures
  • INI Configuration - INI format support
  • Internationalization - Multi-locale messages with ICU formatting
  • Schema Generation - JSON Schema and OpenAPI POJO generation

Getting Help

If you encounter any issues or have questions about using Propify:

  • GitHub Issues: Submit a new issue on our GitHub repository
  • Documentation: Check the Wiki for detailed documentation
  • Examples: Browse the example directory for sample projects

Contributing

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/xyz)
  3. Implement and test your changes
  4. Submit a Pull Request

Please follow the existing coding style and update tests.


License

MIT © 2024 vgerbot-libraries


Acknowledgments

  • JavaPoet - Java source file generation
  • Jackson YAML - YAML parsing
  • Apache Commons Configuration - Configuration management
  • ICU4J - Internationalization support

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言