提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.tenant.config; |
H |
2 |
|
|
3 |
import com.iailab.framework.tenant.core.rpc.TenantRequestInterceptor; |
|
4 |
import com.iailab.module.system.api.tenant.TenantApi; |
|
5 |
import org.springframework.boot.autoconfigure.AutoConfiguration; |
|
6 |
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|
7 |
import org.springframework.cloud.openfeign.EnableFeignClients; |
|
8 |
import org.springframework.context.annotation.Bean; |
|
9 |
import org.springframework.context.annotation.Configuration; |
|
10 |
|
|
11 |
@AutoConfiguration |
|
12 |
@ConditionalOnProperty(prefix = "iailab.tenant", value = "enable", matchIfMissing = true) // 允许使用 iailab.tenant.enable=false 禁用多租户 |
|
13 |
@EnableFeignClients(clients = TenantApi.class) // 主要是引入相关的 API 服务 |
|
14 |
public class IailabTenantRpcAutoConfiguration { |
|
15 |
|
|
16 |
@Bean |
|
17 |
public TenantRequestInterceptor tenantRequestInterceptor() { |
|
18 |
return new TenantRequestInterceptor(); |
|
19 |
} |
|
20 |
|
|
21 |
} |