增加如下代码:第三方调用正常
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.core.ResolvableType;
@Configuration
@RequiredArgsConstructor
public class LoadBalancerClientsInitializer {
private final LoadBalancerClientFactory loadBalancerClientFactory;
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() {
loadBalancerClientFactory.getInstance("需要调用的服务名称", ResolvableType.NONE);
}
}