Move MongoDB Docker Compose support into spring-boot-mongodb

See gh-46114
This commit is contained in:
Phillip Webb
2025-07-01 12:01:48 +01:00
committed by Andy Wilkinson
parent 8532ef0080
commit fa86100b90
10 changed files with 31 additions and 7 deletions
@@ -2,7 +2,6 @@
org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactory=\
org.springframework.boot.docker.compose.service.connection.clickhouse.ClickHouseR2dbcDockerComposeConnectionDetailsFactory,\
org.springframework.boot.docker.compose.service.connection.mariadb.MariaDbR2dbcDockerComposeConnectionDetailsFactory,\
org.springframework.boot.docker.compose.service.connection.mongo.MongoDockerComposeConnectionDetailsFactory,\
org.springframework.boot.docker.compose.service.connection.mysql.MySqlR2dbcDockerComposeConnectionDetailsFactory,\
org.springframework.boot.docker.compose.service.connection.neo4j.Neo4jDockerComposeConnectionDetailsFactory,\
org.springframework.boot.docker.compose.service.connection.oracle.OracleFreeR2dbcDockerComposeConnectionDetailsFactory,\
@@ -20,6 +20,7 @@ plugins {
id "org.springframework.boot.auto-configuration"
id "org.springframework.boot.configuration-properties"
id "org.springframework.boot.deployed"
id "org.springframework.boot.docker-test"
id "org.springframework.boot.optional-dependencies"
}
@@ -29,6 +30,7 @@ dependencies {
api(project(":spring-boot-project:spring-boot"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional(project(":spring-boot-project:spring-boot-docker-compose"))
optional(project(":spring-boot-project:spring-boot-reactor"))
optional(project(":spring-boot-project:spring-boot-testcontainers"))
optional("io.netty:netty-transport")
@@ -36,6 +38,10 @@ dependencies {
optional("org.mongodb:mongodb-driver-sync")
optional("org.testcontainers:mongodb")
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
dockerTestImplementation(testFixtures(project(":spring-boot-project:spring-boot-docker-compose")))
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-testcontainers")))
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docker.compose.service.connection.mongo;
package org.springframework.boot.mongodb.docker.compose;
import com.mongodb.ConnectionString;
import org.junit.jupiter.api.condition.OS;
@@ -0,0 +1,9 @@
services:
mongo:
image: '{imageName}'
ports:
- '27017'
environment:
- 'MONGODB_ROOT_USERNAME=root'
- 'MONGODB_ROOT_PASSWORD=secret'
- 'MONGODB_DATABASE=testdb'
@@ -0,0 +1,9 @@
services:
mongo:
image: '{imageName}'
ports:
- '27017'
environment:
MONGO_INITDB_ROOT_USERNAME: 'root'
MONGO_INITDB_ROOT_PASSWORD: 'secret'
MONGO_INITDB_DATABASE: 'mydatabase'
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docker.compose.service.connection.mongo;
package org.springframework.boot.mongodb.docker.compose;
import com.mongodb.ConnectionString;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docker.compose.service.connection.mongo;
package org.springframework.boot.mongodb.docker.compose;
import java.util.Map;
@@ -15,6 +15,6 @@
*/
/**
* Auto-configuration for Docker Compose MongoDB service connections.
* Support for Docker Compose MongoDB service connections.
*/
package org.springframework.boot.docker.compose.service.connection.mongo;
package org.springframework.boot.mongodb.docker.compose;
@@ -1,3 +1,4 @@
# Connection Details Factories
org.springframework.boot.autoconfigure.service.connection.ConnectionDetailsFactory=\
org.springframework.boot.mongodb.docker.compose.MongoDockerComposeConnectionDetailsFactory,\
org.springframework.boot.mongodb.testcontainers.MongoContainerConnectionDetailsFactory
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.docker.compose.service.connection.mongo;
package org.springframework.boot.mongodb.docker.compose;
import java.util.Collections;
import java.util.Map;