---
title: "Discussion on \"Spring Boot下如何实现数据库的多租户\" | Hashnode"
description: "Discussion on \"Spring Boot下如何实现数据库的多租户\". 在我们常规开发的SaaS平台中，我们有个很常用的需求是通过多租户将不同用户之间的数据和资源隔离开。\n通常情况下，多租户有三种形式：\n1、分区（Partitioned）数据：不同租户的数据都在一张表里，通过一个值（tenantId）来区分不同的租户。\n\n2、分结构（Schema）：不同的租户数据放置在相同数据库实例的不同结构（Schema）中。\n\n3、分数据库（Database）：不同租户的数据放置在不同的数据中。\n\n在Spring Boot中，多租户的能力是由Hibernate提供的，我们在本文..."
url: "https://hashnode.com/posts/spring-boot-multitenant/634bc49dd26fcf0ccc638f2d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Spring Boot下如何实现数据库的多租户](https://wisely.top/spring-boot-multitenant?utm_source=hashnode&utm_medium=feed)

在我们常规开发的SaaS平台中，我们有个很常用的需求是通过多租户将不同用户之间的数据和资源隔离开。 通常情况下，多租户有三种形式： 1、分区（Partitioned）数据：不同租户的数据都在一张表里，通过一个值（tenantId）来区分不同的租户。 2、分结构（Schema）：不同的租户数据放置在相同数据库实例的不同结构（Schema）中。 3、分数据库（Database）：不同租户的数据放置在不同的数据中。 在Spring Boot中，多租户的能力是由Hibernate提供的，我们在本文...

Oct 16, 2022 · 4 min read · wisely.top  
Read the article

-   [#multitenant](https://hashnode.com/tag/multitenant)
-   [#springboot](https://hashnode.com/tag/springboot)
-   [#hibernate](https://hashnode.com/tag/hibernate)
-   [#spring-data-jpa](https://hashnode.com/tag/spring-data-jpa)

## Written by

[yunfei wang](https://hashnode.com/@wiselyman)

@wiselyman · CN

  
[View profile](https://hashnode.com/@wiselyman)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
