{"id":14959410,"url":"https://github.com/playtikaoss/testcontainers-spring-boot","last_synced_at":"2026-01-16T07:55:46.555Z","repository":{"id":37836865,"uuid":"107895339","full_name":"PlaytikaOSS/testcontainers-spring-boot","owner":"PlaytikaOSS","description":"Container auto-configurations for Spring Boot based integration tests","archived":false,"fork":false,"pushed_at":"2025-05-12T12:48:49.000Z","size":5880,"stargazers_count":866,"open_issues_count":37,"forks_count":242,"subscribers_count":39,"default_branch":"develop","last_synced_at":"2025-05-12T13:46:28.085Z","etag":null,"topics":["aerospike","autoconfiguration","couchbase","docker","dynamodb","google-pubsub","kafka","keycloak","mariadb","memsql","minio","mongodb","neo4j","oracle","rabbitmq","redis","spring-boot","testcontainers","vault","voltdb"],"latest_commit_sha":null,"homepage":"https://www.playtika.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlaytikaOSS.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-22T19:17:46.000Z","updated_at":"2025-05-12T12:47:54.000Z","dependencies_parsed_at":"2024-11-05T15:24:16.357Z","dependency_job_id":"8b7f56e2-dd8b-48b4-b539-d2ab4a4a13d3","html_url":"https://github.com/PlaytikaOSS/testcontainers-spring-boot","commit_stats":{"total_commits":1839,"total_committers":108,"mean_commits":17.02777777777778,"dds":0.6835236541598695,"last_synced_commit":"96759a56b4bdf4d5e24223b1c28f535591e120c5"},"previous_names":["playtika/testcontainers-spring-boot"],"tags_count":168,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlaytikaOSS%2Ftestcontainers-spring-boot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlaytikaOSS%2Ftestcontainers-spring-boot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlaytikaOSS%2Ftestcontainers-spring-boot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlaytikaOSS%2Ftestcontainers-spring-boot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlaytikaOSS","download_url":"https://codeload.github.com/PlaytikaOSS/testcontainers-spring-boot/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069596,"owners_count":22009558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aerospike","autoconfiguration","couchbase","docker","dynamodb","google-pubsub","kafka","keycloak","mariadb","memsql","minio","mongodb","neo4j","oracle","rabbitmq","redis","spring-boot","testcontainers","vault","voltdb"],"created_at":"2024-09-24T13:19:38.690Z","updated_at":"2026-01-16T07:55:46.548Z","avatar_url":"https://github.com/PlaytikaOSS.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Testcontainers Spring Boot\n\nhttps://codecov.io/gh/PlaytikaOSS/testcontainers-spring-boot[image:https://codecov.io/gh/PlaytikaOSS/testcontainers-spring-boot/graph/badge.svg?token=9E0VBFIB5B[codecov]]\nhttps://maven-badges.herokuapp.com/maven-central/com.playtika.testcontainers/testcontainers-spring-boot[image:https://maven-badges.herokuapp.com/maven-central/com.playtika.testcontainers/testcontainers-spring-boot/badge.svg[Maven Central]]\n\nIf you develop services using Spring Boot and maybe Spring Cloud and you do\nhttps://testing.googleblog.com/2010/12/test-sizes.html[medium sized] tests during build process, then this set of\nSpring Boot auto-configurations might be handy. By adding module into classpath, you will get stateful service,\nlike Couchbase or Kafka, auto-started and available for connection from your application service w/o wiring any\nadditional code. https://www.docker.com/[Docker] and https://www.testcontainers.org/[TestContainers] are used to\nbootstrap stateful service using Spring Cloud https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_the_bootstrap_application_context[bootstrap phase].\nUsage of Spring Cloud in your production code is optional, but __you will need it in tests__. See \u003c\u003chow-to-use, How to use\u003e\u003e below.\n\n== Versions compatibility\n\n|===\n| Spring Boot | Test Containers Spring Boot\n\n|2.5.X, 2.6.X, 2.7.X\n|2.X.X\n\n|3.0.X, 3.1.X\n|3.0.X\n\n|3.2.X, 3.3.X, 3.4.X, 3.5.X\n|3.1.X\n|===\n\n[[how-to-use]]\n== How to use\n\n. https://docs.docker.com/install/[Install Docker] on your machine\n. Make sure you have http://projects.spring.io/spring-cloud/#quick-start[Spring Boot and Spring Cloud] in classpath of your tests.\nIn case if you need to https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap[pick version].\n+\n.pom.xml\n[source,xml]\n----\n\u003cproject\u003e\n...\n      \u003cdependency\u003e\n            \u003cgroupId\u003eorg.springframework.cloud\u003c/groupId\u003e\n            \u003cartifactId\u003espring-cloud-starter-bootstrap\u003c/artifactId\u003e\n            \u003c!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap --\u003e\n            \u003cversion\u003e[pick version]\u003c/version\u003e\n        \u003c/dependency\u003e\n...\n\u003c/project\u003e\n----\n+\nNOTE: `testcontainers-spring-boot` project migrated to Spring Boot 2.4 in 2.0.0 version.\nPlease note, that in order to use this project with Spring Boot 2.4, you need to use `spring-cloud-starter-bootstrap` dependency.\nFor earlier Spring Boot (prior to 2.4) users -- you need to use `spring-cloud-starter` dependency instead.\n\n. If you do not use Spring Cloud - make it work for tests only:\n+\n.pom.xml\n[source,xml]\n----\n\u003cproject\u003e\n...\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n            \u003cartifactId\u003espring-boot-starter\u003c/artifactId\u003e\n            \u003c!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter --\u003e\n            \u003cversion\u003e[pick version]\u003c/version\u003e\n        \u003c/dependency\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003eorg.springframework.cloud\u003c/groupId\u003e\n            \u003cartifactId\u003espring-cloud-starter-bootstrap\u003c/artifactId\u003e\n            \u003c!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-bootstrap --\u003e\n            \u003cversion\u003e[pick version]\u003c/version\u003e\n            \u003cscope\u003etest\u003c/scope\u003e\n        \u003c/dependency\u003e\n...\n\u003c/project\u003e\n----\n\n. Add data service library:\n+\n.pom.xml\n[source,xml]\n----\n\u003cproject\u003e\n...\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.playtika.testcontainers\u003c/groupId\u003e\n            \u003cartifactId\u003eembedded-kafka\u003c/artifactId\u003e\n            \u003c!-- https://mvnrepository.com/artifact/com.playtika.testcontainers/ --\u003e\n            \u003cversion\u003e[pick version]\u003c/version\u003e\n            \u003cscope\u003etest\u003c/scope\u003e\n        \u003c/dependency\u003e\n...\n\u003c/project\u003e\n----\n\n. Use produced properties in your configuration.\n+\nExample:\n+\n./src/test/resources/application.properties\n[source,properties]\n----\nspring.kafka.bootstrap-servers=${embedded.kafka.brokerList}\n----\n+\n./src/test/resources/bootstrap.properties\n[source,properties]\n----\nembedded.kafka.topicsToCreate=some_topic\n----\n\n== In-depth guides, how-tos and samples\n\n- https://martinfowler.com/articles/microservice-testing/[Testing Strategies in a Microservice Architecture]\n- https://dzone.com/articles/advanced-functional-testing-in-spring-boot-by-usin[Functional Testing in Spring Boot Using Docker in Tests]\n- https://github.com/tdanylchuk/functional-tests-best-practices[Functional tests best practices sample repo]\n- https://medium.com/@isadounikau/microservices-integration-testing-spring-boot-404b6f8617d1[Spring Boot Microservices Integration Testing]\n- https://mydeveloperplanet.com/2020/05/05/easy-integration-testing-with-testcontainers[Easy Integration Testing With Testcontainers]\n- https://dev.to/sivalabs/springboot-integration-testing-using-testcontainers-starter-13h2[SpringBoot Integration Testing using TestContainers Starter]\n- https://alexromanov.github.io/2019/04/02/spring-boot-docker-containers/[Easy way to test Spring Boot microservices]\n\n== Common configuration options\n=== Shutdown of embedded containers on spring application shutdown immediately\n./src/test/resources/application.properties\n[source,properties]\n----\nembedded.containers.forceShutdown=true #default is false\n----\nNOTE: Otherwise, it will be shutdown with delay, see https://github.com/testcontainers/moby-ryuk\n\n=== Disable all embedded containers\n\n./src/test/resources/bootstrap.properties\n[source,properties]\n----\nembedded.containers.enabled=true #default is true\n----\nNOTE: If you setup, for example  embedded.kafka.enabled + embedded.containers.enabled, result will be same as using AND between two booleans.\n\nNOTE: embedded.kafka.enabled=false will cause DockerNotPresentException if you don't have docker installed. But embedded.containers.enabled=false won't cause any exceptions in this case.\n\n|===\n|Setting1 |Setting2 |Outcome\n\n|embedded.containers.enabled=false\n|embedded.memsql.enabled=true\n|Memsql will not start\n\n|embedded.containers.enabled=true\n|embedded.memsql.enabled=false\n|Memsql will not start\n\n|embedded.containers.enabled=true\n|embedded.memsql.enabled=true\n|Memsql will start\n\n|embedded.containers.enabled is missing\n|embedded.memsql.enabled is missing\n|Memsql will start\n|===\n\n=== Other specific container related properties\n[cols=\"a,a,a\"]\n|===\n|Setting name | Default value |Description\n\n|embedded.{module-name}.dockerImage\n|Depends on module\n|Full Docker image name for container setup. Most of the modules have default value already setup.\n\n|embedded.{module-name}.dockerImageVersion\n|N/A\n|Use this property if you want to override only Docker image's version.\n\n|embedded.{module-name}.waitTimeoutInSeconds\n|60\n|Waiting time for a container to start in seconds\n\n|embedded.{module-name}.enabled\n|true\n|Enables a container to be started on startup\n\n|embedded.{module-name}.reuseContainer\n|false\n|Enables a reuse container Testcontainers feature. For more info please refer to: https://github.com/testcontainers/testcontainers-java/pull/2555 and https://github.com/testcontainers/testcontainers-java/pull/1781.\n\n|embedded.{module-name}.command\n|null\n|List of keywords which combines into command for container startup. Some modules ship container's commands by default, so resetting this value may lead to incorrect work of container.\n\n|embedded.{module-name}.attachContainerLog\n|false\n|Attach embedded container output log.\n\n|embedded.{module-name}.env\n|null\n|key-value map of additional environment variables. Where key is name of variable and value is actual value of it.\n\n|embedded.{module-name}.label\n|null\n|key-value map of additional labels to the container. Where key is name of label and value is actual value of label.\n\n|embedded.{module-name}.filesToInclude\n| empty list\n|List of files to include objects.\nEach object should have two parameters:\n\n * `classpathResource` (path to local file)\n * `containerPath` (path in a container to where file needs to be copied)\n\nExample:\n[source,yaml]\n----\nembedded.redis.filesToInclude:\n  classpathResource: \"/my_local_file.txt\"\n  containerPath: \"/etc/path_in_container.txt\"\n----\n\n|embedded.{module-name}.mountVolumes\n| empty list\n|List of mount volumes to persist between container restarts.\nEach object should have three parameters:\n\n * `hostPath` (path to local file/directory)\n * `containerPath` (path in container to mount file/directory onto)\n * `mode` (access mode default *READ_ONLY*, or *READ_WRITE*)\n\nExample:\n[source,yaml]\n----\nembedded.postgresql.mountVolumes:\n  hostPath: \"pgdata\"\n  containerPath: \"/var/lib/postgresql/data\"\n  mode: READ_WRITE\n----\n\n|embedded.{module-name}.capabilities\n| empty list. `NET_ADMIN` is set for Aerospike, Couchbase, Elasticsearch, Kafka, Mariadb, Memsql, Minio, Mongodb, Mysql, Neo4j, Redis containers.\n|The Linux capabilities that should be enabled. You can disable all capabilities by providing empty value for this property.\nSee: https://man7.org/linux/man-pages/man7/capabilities.7.html.\nAvailable values can be taken from `com.github.dockerjava.api.model.Capability` class.\n\n|embedded.{module-name}.tmpFs.mounts\n| empty list\n| A list of container directories which should be replaced by tmpfs mounts, and their corresponding mount options. Check https://docs.docker.com/storage/tmpfs/[TmpFs mount docs].\n\nFor example, for MariaDb:\n[source,yaml]\n----\nembedded:\n  mariadb:\n    tmp-fs:\n      mounts:\n        - folder: /var/lib/mysql\n          options: rw\n----\n\n|===\n\n\n== Supported services\n\n=== link:embedded-mariadb/README.adoc[embedded-mariadb]\n\n=== link:embedded-couchbase/README.adoc[embedded-couchbase]\n\n=== link:embedded-kafka/README.adoc[embedded-kafka]\n\n=== link:embedded-native-kafka/README.adoc[embedded-native-kafka]\n\n=== link:embedded-rabbitmq/README.adoc[embedded-rabbitmq]\n\n=== link:embedded-aerospike/README.adoc[embedded-aerospike]\n\n=== link:embedded-memsql/README.adoc[embedded-memsql]\n\n=== link:embedded-redis/README.adoc[embedded-redis]\n\n=== link:embedded-neo4j/README.adoc[embedded-neo4j]\n\n=== link:embedded-postgresql/README.adoc[embedded-postgresql]\n\n=== link:embedded-elasticsearch/README.adoc[embedded-elasticsearch]\n\n=== link:embedded-opensearch/README.adoc[embedded-opensearch]\n\n=== link:embedded-dynamodb/README.adoc[embedded-dynamodb]\n\n=== link:embedded-voltdb/README.adoc[embedded-voltdb]\n\n=== link:embedded-minio/README.adoc[embedded-minio]\n\n=== link:embedded-mongodb/README.adoc[embedded-mongodb]\n\n=== link:embedded-google-pubsub/README.adoc[embedded-google-pubsub]\n\n=== link:embedded-google-storage/README.adoc[embedded-google-storage]\n\n=== link:embedded-keycloak/README.adoc[embedded-keycloak]\n\n=== link:embedded-keydb/README.adoc[embedded-keydb]\n\n=== link:embedded-influxdb/README.adoc[embedded-influxdb]\n\n=== link:embedded-vault/README.adoc[embedded-vault]\n\n=== link:embedded-oracle-xe/README.adoc[embedded-oracle-xe]\n\n=== link:embedded-mysql/README.adoc[embedded-mysql]\n\n=== link:embedded-localstack/README.adoc[embedded-localstack]\n\n=== link:embedded-cassandra/README.adoc[embedded-cassandra]\n\n=== link:embedded-clickhouse/README.adoc[embedded-clickhouse]\n\n=== link:embedded-pulsar/README.adoc[embedded-pulsar]\n\n=== link:embedded-vertica/README.adoc[embedded-vertica]\n\n=== link:embedded-prometheus/README.adoc[embedded-prometheus]\n\n=== link:embedded-grafana/README.adoc[embedded-grafana]\n\n=== link:embedded-consul/README.adoc[embedded-consul]\n\n=== link:embedded-artifactory/README.adoc[embedded-artifactory]\n\n=== link:embedded-azurite/README.adoc[embedded-azurite]\n\n=== link:embedded-toxiproxy/README.adoc[embedded-toxiproxy]\n\n=== link:embedded-nats/README.adoc[embedded-nats]\n\n=== link:embedded-k3s/README.adoc[embedded-k3s]\n\n=== link:embedded-mockserver/README.adoc[embedded-mockserver]\n\n=== link:embedded-solr/README.adoc[embedded-solr]\n\n=== link:embedded-cockroachdb/README.adoc[embedded-cockroachdb]\n\n=== link:embedded-git/README.adoc[embedded-git]\n\n=== link:embedded-wiremock/README.adoc[embedded-wiremock]\n\n=== link:embedded-mailhog/README.adoc[embedded-mailhog]\n\n=== link:embedded-spicedb/README.adoc[embedded-spicedb]\n\n== How to contribute\n\n=== Flow\n\n* You need to fork project and create branch from `develop`\n* You do not need to update project version in `pom.xml` files, this will be done by release job\n* Once finished - create pull request to `develop` from your fork, pass review and wait for merge\n* On release, ci job will update to next release version + publish artifacts to the Maven Central\n\n=== Checklist for contributing new module\n\n* Naming/formatting patterns match existing code\n* Test for success scenario\n* Test for negative scenario (autoconfiguration is disabled via properties). https://spring.io/blog/2018/03/07/testing-auto-configurations-with-spring-boot-2-0[How to test autoconfiguration]\n* Add new module to `testcontainers-spring-boot-bom`\n* Module provides documentation in `README.adoc` and this documentation is included in parent `README.adoc` (see an example in already existing modules). Documentation should include:\n** maven module declaration\n** consumed properties\n** produced properties\n** notes (if applicable)\n** example of usage\n\n== Release\n//* Release build is done using https://github.com/aleksandr-m/gitflow-maven-plugin[gitflow-maven-plugin]\n* Release is done per each major change, critical bug\n* Release can be done by contributor request\n* Contacts to start release:\n** mailto:sstus@playtika.com[sstus@playtika.com]\n** mailto:iyova@playtika.com[iyova@playtika.com]\n** mailto:admitrov@playtika.com[admitrov@playtika.com]\n** mailto:rkvasnytskyi@playtika.com[rkvasnytskyi@playtika.com]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaytikaoss%2Ftestcontainers-spring-boot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplaytikaoss%2Ftestcontainers-spring-boot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaytikaoss%2Ftestcontainers-spring-boot/lists"}