CDMA1333 2019-06-11 11:12 采纳率: 0%
浏览 931
已结题

求助大神帮忙看看,关于feign调用的一个问题,卡在那里直到超时

启动类⬇

package com.tz;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages= {"com.tz"})
public class EurekaServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }

}

feign接口⬇

package com.tz.services;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name="compute-service")
public interface ITestFeign {
    @RequestMapping(value = "feignTest", method = RequestMethod.GET)
    public String testFeign();
}

feigin接口的实现类⬇

package com.tz.services.impl;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.tz.services.ITestFeign;

@Service
public class TestFeign implements ITestFeign {
    @Override
    public String testFeign() {
        return "测试feign调用";
    }

}

Controller⬇

package com.tz.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.tz.services.ITestFeign;
import com.tz.services.impl.TestFeign;
import com.tz.vos.TestVo;

import org.apache.log4j.Logger;

@RestController
public class ClientController {
    private final Logger logger = Logger.getLogger(getClass());
    @Autowired
    private ITestFeign testFeign;

    @RequestMapping(value = "feignTest", method = RequestMethod.GET)
    //@ResponseBody
    public String testFeign() {
        logger.info("======testFeign========");
        String str = testFeign.testFeign();
        logger.info("======str========"+str);
        return str;
    }
}


spring.application.name=compute-service
server.port=2222
eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
hystrix.command.default.execution.timeout.enabled=true
hystrix.threadpool.default.coreSize=500000
hystrix.command.default.circuitBreaker.requestVolumeThreshold=1000
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=300000
ribbon.ConnectTimeout=3000
ribbon.ReadTimeout=3000
eureka.client.fetch-registry=true
eureka.client.register-with-eureka=true
logging.level.root=debugger

调用之后就一直报超时,也不知道什么原因,请大神帮我看看,谢谢。

  • 写回答

3条回答

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算