apollo icon indicating copy to clipboard operation
apollo copied to clipboard

feign的配置如何继承到apollo里

Open cwtree opened this issue 5 years ago • 4 comments

@FeignClient(name = "k8s-order", url = "${cube.boot.order-find-url}") @Component public interface MyRpc {

@GetMapping("/find/{id}")
public String order(@PathVariable Long id);

}

如上的url配置,如何能够利用上apollo的配置热更新,而且,通过一个config类.get方法去获取这个配置可否? @Getter @Setter @ToString @Component @ConfigurationProperties(prefix = "cube.boot") @RefreshScope public class MyConfig {

private String orderFindUrl;

} 把feign改成如下 @FeignClient(name = "k8s-order", url = myConfig.getxxxx)

不知道apollo如何支持,感谢!

cwtree avatar Mar 15 '21 11:03 cwtree

feign client 初始化读取配置直接用 spring 的 placeholder 就可以了,不过热更新还需要 feign client 自己有方法能设置 url。 如果 feign client 没有相关支持的话,可以看下是否能对 @FeignClient 叠加 @RefreshScope。

nobodyiam avatar Mar 16 '21 00:03 nobodyiam

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in 14 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 04 '21 08:06 stale[bot]

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

stale[bot] avatar Jul 08 '21 06:07 stale[bot]

FeignClient中的URL配置怎么让它生效的?

luoyonghui55 avatar Mar 10 '23 02:03 luoyonghui55