package cn.axzo.workflow.starter;

import cn.axzo.workflow.starter.api.WorkflowCoreService;
import cn.axzo.workflow.starter.api.WorkflowManageService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientFactoryBean;
import org.springframework.context.annotation.Configuration;

/**
 * 根据参数动态实例化可用 Bean
 *
 * @author wangli
 * @since 2024/6/11 21:26
 */
@Configuration(proxyBeanMethods = false)
public class StarterFeignClientConfiguration {

    @Configuration(proxyBeanMethods = false)
    @ConditionalOnClass(FeignClientFactoryBean.class)
    @EnableFeignClients(clients = WorkflowCoreService.class)
    public static class WorkflowCoreServiceClient {
    }

    @Configuration(proxyBeanMethods = false)
    @ConditionalOnProperty(prefix = "workflow", value = "manageable", havingValue = "true")
    @ConditionalOnClass(FeignClientFactoryBean.class)
    @EnableFeignClients(clients = WorkflowManageService.class)
    public static class WorkflowManageServiceClient {
    }

}
