支持请求地址从yaml配置文件读取吗
wangran99 opened this issue · 2 comments
wangran99 commented
文档里地址可以这么写:
@address(host = "127.0.0.1", port = "8080")
public interface MyClient {
// 绑定接口上的默认根地址
// 最终URL: http://127.0.0.1:8080/data1
@Post("/data1")
ForestRequest<String> sendData1();
// 绑定接口上的默认根地址
// 最终URL: http://127.0.0.1:8080/data2
@Post("/data2")
ForestRequest<String> sendData2();
// 使用方法上的根地址
// 最终URL: http://192.168.0.1:7000/data3
@Post("/data3")
@Address(host = "192.168.0.1", port = "7000")
ForestRequest<String> sendData3();
}
可不可以读取yaml里的自定义配置项,比如:@address(host = "${service.ip}", port = "${service.port}") ?
wangran99 commented
应该可以这样做吧?
@address(host = "#{record.ip}", port = "#{record.port}")
public interface MyClient {
}
wangran99 commented
可以的!