spring-boot:run ok spring-boot:aot
Exception in thread "main" org.springframework.beans.factory.aot.AotProcessingException: Error executing 'org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor': Error creating bean with name 'jdbcDialect' defined in class path resource [org/example/springbootdemo/dao/config/CustomJdbcConfiguration.class]: Unsatisfied dependency expressed through method 'jdbcDialect' parameter 0: Error creating bean with name 'namedParameterJdbcTemplate' defined in class path resource [org/springframework/boot/jdbc/autoconfigure/NamedParameterJdbcTemplateConfiguration.class]: Failed to initialize dependency 'dataSourceScriptDatabaseInitializer' of NamedParameterJdbcOperations bean 'namedParameterJdbcTemplate': Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resource [org/springframework/boot/jdbc/autoconfigure/DataSourceInitializationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseInitializer' parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/jdbc/autoconfigure/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
Comment From: rhdai
springboot 4.0.0
Comment From: snicoll
@rhdai a stacktrace doesn't make this issue actionable. I can't guess why the application starts but AOT processing fails this way. It's also unclear if that used to work before. If you want support, please prepare a small sample that we can run ourselves to reproduce the problem. You can attach a zip here or push the projet on a GitHub repository.
Comment From: agryash
@rhdai I attempted to reproduce this behavior using Spring Boot 4.0.0 and Java 25 (GraalVM Community), but I was unable to trigger the error. Here is the link to my repo.
My reproduction setup used H2 with runtimeOnly scope and relied on URL inference (omitting driver-class-name in properties), which is the usual trigger for this error. However, the native image built and started successfully.
I suspect this works for me because the H2 driver includes embedded GraalVM reachability metadata, which automatically registers the driver for reflection, even when Spring Boot doesn't explicitly hint it.
To help narrow this down:
- Which specific database driver and version are you using?
- Are you configuring the DataSource via application.properties or a custom
@Bean?
Comment From: rhdai
@agryash @snicoll After adding spring-boot-starter-data-jdbc postgresql to your project, the addition of sysUser and SysUserRepository resulted in the following issue. Below is my repository url