package com.cf.imes.framework.organ.config;

import com.cf.imes.framework.organ.core.rpc.OrganRequestInterceptor;
import com.cf.imes.module.system.api.organ.OrganApi;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@AutoConfiguration
@ConditionalOnProperty(prefix = "chenfeng.organ", value = "enable", matchIfMissing = true) // 允许使用 chenfeng.organ.enable=false 禁用多组织
@EnableFeignClients(clients = OrganApi.class) // 主要是引入相关的 API 服务
public class ChenfengOrganRpcAutoConfiguration {

    @Bean
    public OrganRequestInterceptor organRequestInterceptor() {
        return new OrganRequestInterceptor();
    }

}
