Description
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]