-
Notifications
You must be signed in to change notification settings - Fork 378
Closed as not planned
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
In my custom BeanFactoryInitializationAotProcessor class, if I use beanFactory.getBeansOfType to get a bean where this bean has dependency on repository interface, build fails throwing:
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:186)
at org.springframework.boot.autoconfigure.jdbc.PropertiesJdbcConnectionDetails.getDriverClassName(PropertiesJdbcConnectionDetails.java:49)
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:55)
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:117)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
How to reproduce: checkout this repo: https://github.com/jeffawx/native-jdbc
Run: ./gradlew processAot should see error
I understand the bean context isn't fully initialised at this stage, but do we have some mechanism to force repository beans initialise properly before AOT processing happens?
Mark the repository as @Lazy fix the problem, but its a bit ugly, is there any proper way?
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged