Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phage-solutions/protobuf-graalvm-native-hints
Repository containing the native hints needed for ProtoBuf messages inside GraalVM with Spring Boot 3
https://github.com/phage-solutions/protobuf-graalvm-native-hints
graalvm graalvm-native-image gradle kotlin spring spring-boot
Last synced: 1 day ago
JSON representation
Repository containing the native hints needed for ProtoBuf messages inside GraalVM with Spring Boot 3
- Host: GitHub
- URL: https://github.com/phage-solutions/protobuf-graalvm-native-hints
- Owner: Phage-Solutions
- License: mit
- Created: 2024-12-09T14:57:54.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T16:02:29.000Z (2 months ago)
- Last Synced: 2024-12-19T09:12:45.232Z (about 2 months ago)
- Topics: graalvm, graalvm-native-image, gradle, kotlin, spring, spring-boot
- Language: Kotlin
- Homepage:
- Size: 112 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
![protobuf-graalvm-native-hints](readme-resources/graalvm-native-hints.png)
# Protobuf GraalVM Native Hints for Spring Boot 3
Simple library to register protobuf (v4) generated classes for runtime reflection. The library is [published to Maven Central](https://central.sonatype.com/artifact/sk.phage.spring/protobuf-graalvm-native-hints/overview), so there is no
need to add any additional repositories.More details on the topic can be found [here](https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Reflection/#configuration-with-features)
## Content
- [Dependencies](#dependencies)
- [Usage](#usage)
- [Configuration](#usage)## Dependencies
NOTE: See [build.gradle.kts](lib/build.gradle.kts) for the latest version of the dependencies.
List:
- Protocol Buffers 4.x.x
- GraalVM 17+
- Java 17+
- Spring Boot 3.x.x
- Reflections## Usage
### Add the library to your project:
**Gradle (Groovy)**```groovy
implementation 'sk.phage.spring:protobuf-graalvm-native-hints:${version}'
```**Gradle (Kotlin DSL):**
```kotlin
implementation("sk.phage.spring:protobuf-graalvm-native-hints:${version}")
```**Maven**
```xml
sk.phage.spring
protobuf-graalvm-native-hints
${version}```
### Usage
You need to register the class in your Spring Boot application via the `@ImportRuntimeHints` application.
```kotlin
@ImportRuntimeHints(ProtobufNativeHints::class)
```During AOT compilation, the class will be picked up and all classes that extend the `GeneratedMessage` (incl. inner `Builder` classes, subtypes and `ProtocolMessageEnum`) will be registered for reflection (including all fields, constructors
and methods).## Configuration
You will need to specify packages which contain your compiled ProtoBuf classes in the `META-INF/native-image/protobuf-packages.properties` file.Example:
```properties
sk.phage.serialization
com.google.protobuf
```