我目前只是在检查如何在我的一个项目中使用 Feign 作为声明性 REST 客户端。
以下是 Feign 客户端
@FeignClient(name = "SEARCHCABMS",configuration = AppFeignConfiguration.class)
public interface SearchCabMsClient {
@RequestMapping(value = "api/searchcab/locationcabtimedetail/search/getCabForLocationAfterTimeSlot", method = RequestMethod.GET)
String searchCabDetails(@PathVariable("fromDate") String fromDate,
@PathVariable("locationId") long locationId,
@PathVariable("isdeleted") byte isdeleted,
@PathVariable("hourforbooking")int hourforbooking);
}
Run Code Online (Sandbox Code Playgroud)
此接口在一项服务中自动装配
@Autowired
SearchCabMsClient restService;
Run Code Online (Sandbox Code Playgroud)
将 EnableFeignClients 添加到 SpringBootApplication
@EnableFeignClients(basePackages = {"com.gp.cabbooking.services.feign"})
Run Code Online (Sandbox Code Playgroud)
pom.xml 中的依赖项、父项等
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
Run Code Online (Sandbox Code Playgroud)
依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在为我的假客户端调试 spring 创建代理时,我可以看到我尝试在功能区的帮助下调用此服务,它工作正常,但是当我在我的假客户端中执行方法定义时。我得到了feign.FeignException: status 404 reading
feign.FeignException: status …Run Code Online (Sandbox Code Playgroud) 目前的问题陈述
,我正在借助 azure terraform 在不同订阅中创建/修改 azure 资源。
错误
Principal <appid> does not exist in the directory {destination-tenant-id-for which contribution role required}
Run Code Online (Sandbox Code Playgroud)
考虑以下场景。
我们希望在一个订阅中创建 Azure AKS 集群,并在同一执行中,我们希望更新另一订阅中的 DNS 定义。如果我们在同一个订阅中同时拥有 ie DNS 区域和 aks 集群,则此过程运行良好,但如果这两个资源位于不同的订阅中,则此过程将不起作用。
采取的步骤
创建服务主体而不分配
az ad sp create-for-rbac -n sp-terraform-001 --skip-assignment
Run Code Online (Sandbox Code Playgroud)
为当前订阅的当前 SP 分配贡献者角色
az role assignment create --assignee <appid> --role Contributor --scope /subscriptions/<sub-id>
Run Code Online (Sandbox Code Playgroud)
*为不同订阅的当前 sp 分配贡献者角色。它将失败并显示 *
az role assignment create --assignee <appid> --role Contributor --scope /subscriptions/<diff-sub-id>/<resource-group>....
Run Code Online (Sandbox Code Playgroud)
请让我知道访问其他订阅中的资源的正确步骤