我试图使用一个微服务作为一个假客户端,但是我得到了这个错误。
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.claro.mcp.client.McpUaaClient'
: FactoryBean threw exception on object creation;
nested exception is java.lang.IllegalStateException: No fallback instance of type class kotlin.Unit found for feign client mcpuaa
Error creating bean with name 'com.claro.mcp.client.McpUaaClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: No fallback instance of type class kotlin.Unit found for feign client mcpuaa我使用的是Kotlin 1.3.40和Spring Boot 2.1.6。释放。我的项目是基于Khipster code generator的
这是我的假客户
@AuthorizedFeignClient(name = "mcpuaa")
public interface McpUaaClient {
@PostMapping("/api/auth/validatePassword")
ResponseEntity<JsonObject> validatePassword(String password);
}我不知道出了什么问题。
发布于 2019-08-18 14:20:39
我设法解决了这个问题,我只需要为我的假客户端实现一个后备。由于Kotlin不支持原语类型,在本例中为"void",这是一种允许spring cloud避免实现回退的类型,因此我不得不创建一个实现来处理这种情况。
https://stackoverflow.com/questions/57501598
复制相似问题