Skip to content

Native reflection hints missing for nested properties declared in a superclass #36406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
justin-tay opened this issue Jul 14, 2023 · 1 comment
Assignees
Labels
theme: aot An issue related to Ahead-of-time processing theme: ssl Issues related to ssl support type: bug A general bug
Milestone

Comments

@justin-tay
Copy link

Trying to configure the ssl bundle for the application which worked normally but failed when compiling to a graal native image.

The following is the sample configuration.

spring:
  ssl:
    bundle:
      jks:
        server:
          key:
            alias: my-key-alias
          keystore:
            location: file:my-keystore.p12
            type: PKCS12
          options:
            enabled-protocols:
            - TLSv1.2
            - TLSv1.3

The values under spring.ssl.bundle.jks.server.key and spring.ssl.bundle.jks.server.options are null in the native image.

When checking the generated reflect-config.json it looks like this is because no hints were generated for org.springframework.boot.autoconfigure.ssl.SslBundleProperties$Options and org.springframework.boot.autoconfigure.ssl.SslBundleProperties$Key.

I have created a simple reproducer at https://github.com/justin-tay/spring-boot-native-sslbundle-issue

The logs when run using mvn spring-boot:run is

2023-07-14T11:36:58.218+08:00  INFO 8892 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Key Alias [my-key-alias]
2023-07-14T11:36:58.218+08:00  INFO 8892 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Keystore Location [file:my-keystore.p12]
2023-07-14T11:36:58.218+08:00  INFO 8892 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Options Enabled Protocols [[TLSv1.2, TLSv1.3]]

The logs when run after compiling to a native image is

2023-07-14T11:36:13.253+08:00  INFO 13908 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Key Alias [null]
2023-07-14T11:36:13.253+08:00  INFO 13908 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Keystore Location [file:my-keystore.p12]
2023-07-14T11:36:13.253+08:00  INFO 13908 --- [           main] com.example.demo.DemoConfiguration       : Bundle [server] Options Enabled Protocols [null]
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 14, 2023
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 19, 2023
@wilkinsona wilkinsona added this to the 3.1.x milestone Jul 19, 2023
@wilkinsona wilkinsona added theme: ssl Issues related to ssl support theme: aot An issue related to Ahead-of-time processing labels Jul 19, 2023
@wilkinsona wilkinsona self-assigned this Jul 19, 2023
@wilkinsona
Copy link
Member

Thanks for the reproducer and initial analysis, @justin-tay. The problem affects any nested properties class that's declared in a superclass. SslBundleProperties and its two sub-classes JksSslBundleProperties and PemSslBundleProperties may be the only place where we have such an arrangement though.

@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.0.x Jul 19, 2023
@wilkinsona wilkinsona changed the title Native reflection hints missing for SslBundleProperties Native reflection hints missing for nested properties declared in a superclass Jul 19, 2023
@wilkinsona wilkinsona modified the milestones: 3.0.x, 3.0.9 Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing theme: ssl Issues related to ssl support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants