小编Ren*_*ier的帖子

如何解决Timeout FeignClient

使用在SQL Server中执行查询的服务时,我的应用程序遇到错误FeignClient.

错误:

线程"pool-10-thread-14"中的异常feign.RetryableException:读取超时执行GET http://127.0.0.1:8876/processoData/search/buscaProcessoPorCliente?cliente=ELEKTRO+-+TRABALHISTA&estado=SP

我的消费者服务:

@FeignClient(url="http://127.0.0.1:8876")
public interface ProcessoConsumer {

@RequestMapping(method = RequestMethod.GET, value = "/processoData/search/buscaProcessoPorCliente?cliente={cliente}&estado={estado}")
public PagedResources<ProcessoDTO> buscaProcessoClienteEstado(@PathVariable("cliente") String cliente, @PathVariable("estado") String estado);

}
Run Code Online (Sandbox Code Playgroud)

我的YML:

server:
  port: 8874

endpoints:
  restart:
    enabled: true
  shutdown:
    enabled: true
  health:
    sensitive: false

eureka:
  client:
  serviceUrl:
    defaultZone: ${vcap.services.eureka-service.credentials.uri:http://xxx.xx.xxx.xx:8764}/eureka/
  instance: 
    preferIpAddress: true

ribbon:
  eureka:
    enabled: true

spring:
  application:
    name: MyApplication
  data:
    mongodb:
      host: xxx.xx.xxx.xx
      port: 27017
      uri: mongodb://xxx.xx.xxx.xx/recortesExtrator
      repositories.enabled: true
    solr:
      host: http://xxx.xx.xxx.xx:8983/solr
      repositories.enabled: true
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个问题?

谢谢.

java spring-data spring-boot netflix-feign

12
推荐指数
4
解决办法
3万
查看次数

bootstrap.yml没有在Spring Boot 2中加载

启动需要连接到配置服务器的Spring Boot客户端应用程序时遇到问题。bootstrap.yml文件被忽略

配置服务器-可行!

server:
  port: 8888  

spring:
  application:
    name: configserver
  cloud:
    config:
      server:
       git:
         uri:https://xxxxx@bitbucket.org/eco/properties.git
Run Code Online (Sandbox Code Playgroud)

bootstrap.yml-配置客户端-不起作用!

spring:
  application:
    name: api
  cloud:
    config:
     uri: http://localhost:8888
Run Code Online (Sandbox Code Playgroud)

启动应用程序时,文件bootstrap.yml被忽略

POM客户端

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.2.RELEASE</version>
</parent>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Finchley.RC2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <spring-cloud.version>2.0.0.RC2</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka</artifactId>
        <version>1.4.4.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <!-- Database dependencies -->
    <dependency> …
Run Code Online (Sandbox Code Playgroud)

java spring-boot spring-cloud

7
推荐指数
3
解决办法
4762
查看次数

如何在ReactJS中完成http请求后才进行渲染

我只需要在完成componentDidMount函数的请求后调用我的组件的render函数.

componentDidMount(){    
    let ctx = this;
    ApiService.get('/busca/empresa/pagina').then(function(response){
      if(response.data.empresa){
        ctx.setState({company:response.data.empresa});
        ctx.getProducts();
        ctx.verifyAuthentication();
      }
    }, function(error){
       Notification.error('HTTP Status: ' + error.response.status + ' - ' + error.response.data.mensagem);
    });
}
Run Code Online (Sandbox Code Playgroud)

问题是当打开页面时,在componentDidMount完成之前调用render函数.始终从else条件(renderNotValidateCompany)返回函数并在更新this.state.company后返回renderValidateCompany.

render(){
    if(this.state.company){
      return this.renderValidateCompany();
    }else{
      return this.renderNotValidateCompany();
    }
}
Run Code Online (Sandbox Code Playgroud)

是否有可能只在componentDidMount在react中完成时才调用渲染?

谢谢!

javascript reactjs

6
推荐指数
1
解决办法
717
查看次数