Was looking to upgrade a spring-boot 3.5.x project to spring boot 4 using https://docs.arconia.io/arconia-cli/latest/update/spring-boot/ and saw
Caused by: org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactoryNotFoundException: No ConnectionDetailsFactory found for source '@ServiceConnection source for Bean 'postgresContainer' ... You may need to add a 'name' to your @ServiceConnection annotation.
So I tried bootstrapping a new project from Spring Initializr:
https://start.spring.io/#!type=gradle-project-kotlin&language=java&platformVersion=4.0.0&packaging=jar&configurationFileFormat=properties&jvmVersion=25&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=web,spring-restclient,postgresql,testcontainers and observe the same issue.
Comment From: philwebb
This is a byproduct of the modularization, you need to include the following SQL dependency which will provide the service connection:
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
Comment From: philwebb
Flagging to see if the team has any ideas how to improve the error.
Comment From: wilkinsona
@adityamparikh can you please share some more details about the dependencies of your real application where the problem occurred? The new project bootstrapped on start.spring.io is a little strange as it depends on Postgres but not on anything to access it such as JDBC, jOOQ, or JPA.
Comment From: adityamparikh
@wilkinsona Thanks! My mistake.
The project builds after adding
implementation("org.springframework.boot:spring-boot-starter-jdbc")
testImplementation("org.springframework.boot:spring-boot-starter-jdbc-test")