Using spring initializr with following configuration https://start.spring.io/#!type=maven-project&language=java&platformVersion=3.1.1&packaging=jar&jvmVersion=17&groupId=com.demo&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.demo.demo&dependencies=lombok,devtools,docker-compose,web,data-jpa,validation,flyway,postgresql,testcontainers,restdocs
Following error occurs during the contextLoads() test
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
... 117 more
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:568)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
... 118 more
Comment From: snicoll
@MaartenAerts I assume you were expecting the test to be configured with testcontainers when it is selected. Which it isn't as you can see, and there is an app in the same directory that is.
If you are requesting an improvement to start.spring.io, this is the wrong issue tracker to ask. If not, please clarify what you're trying to report. Thanks.
Comment From: MaartenAerts
I am surprised start.spring.io generates projects which are not able to build. Your comment did help me, I just have to import the example configuration on the test. Thank you.
I was requesting an improvement to start.spring.io, I now found https://github.com/spring-io/start.spring.io, my apologies.
Comment From: snicoll
Unfortunately I can’t transfer this issue to another org. If you have a minute to create an issue in the appropriate repo I would appreciate it. Thanks.
Comment From: MaartenAerts
https://github.com/spring-io/start.spring.io/issues/1247