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 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP