-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
mongodb: use ServiceConnection #31980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
3c6674a to
8a2162f
Compare
8a2162f to
ecf1f3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request migrates MongoDB integration tests to use Spring Boot's @ServiceConnection annotation, simplifying testcontainer configuration by eliminating the need for manual property registration via @DynamicPropertySource.
Changes:
- Refactored MongoDB testcontainer configuration to use
@ServiceConnectionannotation - Renamed
MongoDbTestContainertoDatabaseTestcontainerfor consistency - Removed manual property source registration and updated test annotations across multiple test files
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| generators/spring-data/generators/mongodb/templates/src/test/java/package/config/DatabaseTestcontainer.java.ejs | Renamed from MongoDbTestContainer, added @Serviceconnection annotation, removed @DynamicPropertySource method |
| generators/spring-data/generators/mongodb/generator.ts | Added cleanup for old MongoDbTestContainer.java file, removed integrationTest task that manually added annotations |
| generators/spring-data/generators/mongodb/files.ts | Updated template file reference to new DatabaseTestcontainer.java name |
| generators/spring-data/generators/mongodb/snapshots/generator.spec.ts.snap | Updated snapshots to reflect renamed file |
| generators/spring-boot/templates/src/test/java/package/web/rest/AccountResourceIT.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
| generators/spring-boot/templates/src/test/java/package/entityPackage/web/rest/_entityClass_ResourceIT.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
| generators/spring-boot/templates/src/test/java/package/entityPackage/web/rest/UserResourceIT.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
| generators/spring-boot/templates/src/test/java/package/entityPackage/web/rest/PublicUserResourceIT.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
| generators/spring-boot/templates/src/test/java/package/entityPackage/service/UserServiceIT.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
| generators/spring-boot/templates/pom.xml.ejs | Changed webapp profile spring.profiles.active from "dev" to "test" |
| generators/spring-boot/generators/cucumber/templates/src/test/java/package/cucumber/CucumberTestContextConfiguration.java.ejs | Added @testcontainers and @ImportTestcontainers annotations for MongoDB, added necessary imports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (below reviewers) and adding
skip-cilabel, you can still see CI build result at your branch.