CtrlK
BlogDocsLog inGet started
Tessl Logo

giuseppe-trisciuoglio/developer-kit

Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.

82

Quality

82%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Validation failed for skills in this tile
One or more skills have errors that need to be fixed before they can move to Implementation and Discovery review.
Overview
Quality
Evals
Security
Files

reflection-resource-config.mdplugins/developer-kit-java/skills/graalvm-native-image/references/

GraalVM Reflection & Resource Configuration

Complete guide for GraalVM metadata files that enable reflection, resources, proxies, and serialization in native images.

Table of Contents

  1. Configuration File Location
  2. Unified Reachability Metadata
  3. Reflection Configuration
  4. Resource Configuration
  5. Proxy Configuration
  6. Serialization Configuration

Configuration File Location

Place metadata files in:

src/main/resources/
  META-INF/native-image/
    <group.id>/
      <artifact.id>/
        reachability-metadata.json    # Unified format (recommended)
        reflect-config.json           # Legacy: reflection only
        resource-config.json          # Legacy: resources only
        proxy-config.json             # Legacy: dynamic proxies
        serialization-config.json     # Legacy: serialization
        jni-config.json               # Legacy: JNI access
        native-image.properties       # Build arguments

GraalVM automatically discovers files in the META-INF/native-image/ directory.

Unified Reachability Metadata

The unified reachability-metadata.json format (recommended for GraalVM 23+) combines all metadata:

{
  "reflection": [
    {
      "type": "com.example.dto.UserDto",
      "allDeclaredConstructors": true,
      "allDeclaredMethods": true,
      "allDeclaredFields": true
    },
    {
      "condition": {
        "typeReached": "com.example.service.OrderService"
      },
      "type": "com.example.dto.OrderDto",
      "methods": [
        {"name": "<init>", "parameterTypes": []},
        {"name": "getId", "parameterTypes": []},
        {"name": "setId", "parameterTypes": ["java.lang.Long"]}
      ],
      "fields": [
        {"name": "id"},
        {"name": "status"}
      ]
    }
  ],
  "resources": [
    {"glob": "application.yml"},
    {"glob": "application-*.yml"},
    {"glob": "templates/**/*.html"},
    {"glob": "static/**"},
    {"glob": "META-INF/services/*"}
  ],
  "bundles": [
    {"name": "messages", "locales": ["en", "it", "de"]}
  ],
  "jni": [
    {
      "type": "com.example.NativeHelper",
      "methods": [
        {"name": "nativeMethod", "parameterTypes": ["int"]}
      ]
    }
  ]
}

Reflection Configuration

Legacy reflect-config.json

[
  {
    "name": "com.example.dto.UserDto",
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true,
    "allDeclaredFields": true,
    "allPublicFields": true
  },
  {
    "name": "com.example.dto.OrderDto",
    "methods": [
      {"name": "<init>", "parameterTypes": []},
      {"name": "<init>", "parameterTypes": ["java.lang.Long", "java.lang.String"]},
      {"name": "getId", "parameterTypes": []},
      {"name": "setId", "parameterTypes": ["java.lang.Long"]}
    ],
    "fields": [
      {"name": "id", "allowWrite": true},
      {"name": "status", "allowWrite": true}
    ]
  },
  {
    "name": "com.example.entity.Product",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true,
    "allDeclaredFields": true,
    "unsafeAllocated": true
  }
]

Common Reflection Flags

FlagDescription
allDeclaredConstructorsRegister all constructors (public and private)
allPublicConstructorsRegister only public constructors
allDeclaredMethodsRegister all methods (public and private)
allPublicMethodsRegister only public methods
allDeclaredFieldsRegister all fields (public and private)
allPublicFieldsRegister only public fields
unsafeAllocatedAllow Unsafe.allocateInstance()

Resource Configuration

Legacy resource-config.json

{
  "resources": {
    "includes": [
      {"pattern": "application\\.yml"},
      {"pattern": "application-.*\\.yml"},
      {"pattern": "logback\\.xml"},
      {"pattern": "logback-spring\\.xml"},
      {"pattern": "META-INF/services/.*"},
      {"pattern": "templates/.*\\.html"},
      {"pattern": "static/.*"},
      {"pattern": "db/migration/.*\\.sql"}
    ],
    "excludes": [
      {"pattern": ".*\\.DS_Store"}
    ]
  },
  "bundles": [
    {"name": "messages", "locales": ["en", "it"]},
    {"name": "ValidationMessages"}
  ]
}

Proxy Configuration

Legacy proxy-config.json

Register interfaces for JDK dynamic proxy generation:

[
  {
    "interfaces": [
      "com.example.service.UserService",
      "org.springframework.aop.SpringProxy",
      "org.springframework.aop.framework.Advised",
      "org.springframework.core.DecoratingProxy"
    ]
  },
  {
    "interfaces": [
      "com.example.repository.OrderRepository",
      "org.springframework.data.repository.Repository"
    ]
  }
]

Serialization Configuration

Legacy serialization-config.json

{
  "types": [
    {"name": "com.example.dto.UserDto"},
    {"name": "com.example.dto.OrderDto"},
    {"name": "java.util.ArrayList"},
    {"name": "java.util.HashMap"}
  ],
  "lambdaCapturingTypes": [
    {"name": "com.example.service.UserService"}
  ]
}

native-image.properties

Configure default build arguments:

Args = --no-fallback \
       -H:+ReportExceptionStackTraces \
       --enable-https \
       --initialize-at-build-time=org.slf4j

plugins

developer-kit-java

skills

README.md

tile.json