Fix OAuth2 native-image session definition initialization - #2193
Open
sdelamo wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GraalVM native-image metadata for the security-oauth2 module to defer initialization of session-backed OAuth2 bean definition classes to runtime, addressing native image build warnings (issue #870).
Changes:
- Added
native-image.propertiesformicronaut-security-oauth2with--initialize-at-run-timeentries for session persistence bean definition classes (nonce, state, PKCE). - Added a focused JUnit test that asserts the packaged metadata file contains the expected native-image arguments/class names.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
security-oauth2/src/test/java/io/micronaut/security/oauth2/Oauth2NativeImageMetadataTest.java |
Verifies the module JAR contains the expected native-image metadata entries for runtime initialization. |
security-oauth2/src/main/resources/META-INF/native-image/io.micronaut.security/micronaut-security-oauth2/native-image.properties |
Adds GraalVM native-image args to initialize session persistence bean definition classes at runtime. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
security-oauth2native-image metadata that initializes OAuth2 session-backed generated bean definitions at run timeCloses #870.
Tests
./gradlew --no-daemon :micronaut-security-oauth2:test --tests io.micronaut.security.oauth2.Oauth2NativeImageMetadataTest -x compileTestGroovy./gradlew --no-daemon :micronaut-security-oauth2:jarMETA-INF/native-image/io.micronaut.security/micronaut-security-oauth2/native-image.propertiesand the three expected class namesRelease Target
5.1.x5.1.05.1.0 Release(Throw an error if multiple annotations are used. #147)PR Assets
No generated or rendered artifacts changed; no PR-visible asset upload is required.
✨ This message was AI-generated using gpt-5