package com.ycl.config; import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; @Data @Component @ConfigurationProperties("zzding") public class DingConfig { private String appKey; private String appSecret; private String domainName; private String protocal; private String tenantId; @Bean public ExecutableClient executableClient() { ExecutableClient executableClient = ExecutableClient.getInstance(); executableClient.setAccessKey(appKey); executableClient.setSecretKey(appSecret); executableClient.setDomainName(domainName); executableClient.setProtocal(protocal); //executableClient要单例,并且使用前要初始化,只需要初始化一次 executableClient.init(); return executableClient; } }