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条回答 默认 最新

  • 关注
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料