Git Product home page Git Product logo

multi-tetant-spring's Introduction

Multi tenant implementation in Spring

1. Testing Multi-tenant with Foreign key

# 1. Build database
docker-compose -f docker/db_foreign_key.yaml up -d  

# 2. Start application 

# 3. Test with simple curl 
curl -H "X-TENANT-ID: 2"  -X GET localhost:8080/data_log | json_pp 

The response will not return data with tenant_id = 2

[
   {
      "dataValue" : "982b9a2a-7d3a-43d8-ae95-3e6a7f46a7e6_tenant_id_2",
      "id" : 2,
      "tenantId" : 2
   },
   {
      "dataValue" : "fcfe5c62-529e-45b2-9de2-87716942d0a1_tenant_id_2",
      "id" : 5,
      "tenantId" : 2
   }
]

2. Testing Multi-tenant with Multi schema

# 1. Build database
docker-compose -f docker/db_multi_schema.yaml up --force-recreate -V -d 

# 2. Start application 

# 3. Test with simple curl 
curl --location 'localhost:8080/data_log' --header 'X-TENANT-ID: CAR_EV' | json_pp 

The response will not return data with tenant_id = CAR_EV

[
  {
    "id": 1,
    "dataValue": "6959e88d-4f66-4f3e-946e-1c695e7abf03_CAR_EV"
  },
  {
    "id": 2,
    "dataValue": "44f7d081-5c8d-4a95-bc59-5a5e5c9a4421_CAR_EV"
  }
]

multi-tetant-spring's People

Contributors

kainguyen-dev avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.