openfeign
POM文件的依赖:
<!--openfeign--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <!--eureka client--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>
注意这里的YML:
server: port: 80 eureka: client: register-with-eureka: false #这里的OPenFeign不注册到Eureke service-url: defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka
#设置feign 客户端超时时间(openFeign默认支持ribbon) ribbon: #指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间 ReadTimeout: 5000 #指的是建立连接后从服务器读取到可用资源所用的时间 ConnectTimeout: 5000 logging: level: #feign日志以什么级别监控哪个接口 com.atguigu.springcloud.service.PaymentFeignService: debug
openfeign的日志级别:
配置日志级别:
package com.atguigu.springcloud.config; import feign.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class FeignConfig { @Bean Logger.Level feignLoggerLevel(){ return Logger.Level.FULL; } }
yml文件:
logging:
level:
com.atguigu.springcloud.service.PaymentFeignService: debug
#feign日志以什么级别监控哪个接口