Skip to content
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

feat : let spring boot handle lifecycle of TestContainer #1600

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions jpa/multitenancy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

Let's see how it works by using three different approaches:

- Partition tables by tenant id. → Single table having partition (Supported Only from Hibernate 6)
- Use a separate schema per tenant. → Single Database having multiple schemas
- Use a separate database per tenant. → Different Databases having same schema (Could be having different aws regions)
| MultiTenancy Type | Description |
|---------------------------------------------------------|--------------------------------------------------------------------------------|
| [Partition tables by tenant id](./partition) | Single table having partition (Supported Only from Hibernate 6) |
| [Use a separate schema per tenant](./schema) | Single Database having multiple schemas |
| [Use a separate database per tenant](./multitenancy-db) | Different Databases having same schema (Could be having different aws regions) |

Additionally another sample which implments Multiple Datasoures and MultiTenancy

[Multi DataSource and Tenancy using schema and db](./multidatasource-multitenancy)
2 changes: 1 addition & 1 deletion jpa/multitenancy/multidatasource-multitenancy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.example.multitenancy.utils.AppConstants;
import org.springframework.boot.SpringApplication;

class MultiDataSourceMultiTenancyApplicationTest {
class TestMultiDataSourceMultiTenancyApplication {

public static void main(String[] args) {
SpringApplication.from(MultiDataSourceMultiTenancyApplication::main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ OracleContainer oracleContainer() {
@Bean
DynamicPropertyRegistrar databaseProperties(
OracleContainer oracleContainer, PostgreSQLContainer<?> postgreSQLContainer) {
oracleContainer.start();
postgreSQLContainer.start();
return (propertyRegistry) -> {
// Connect our Spring application to our Testcontainers instances
propertyRegistry.add("datasource.primary.url", oracleContainer::getJdbcUrl);
Expand Down
Loading