Java 未找到外部客户端的kotlin.Unit类型的回退实例
我试图将一个微服务作为一个假客户端使用,但我发现了这个错误Java 未找到外部客户端的kotlin.Unit类型的回退实例,java,spring,kotlin,microservices,jhipster,Java,Spring,Kotlin,Microservices,Jhipster,我试图将一个微服务作为一个假客户端使用,但我发现了这个错误 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' : FactoryB
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。释放。我的项目是基于
这是我的假客户
@AuthorizedFeignClient(name = "mcpuaa")
public interface McpUaaClient {
@PostMapping("/api/auth/validatePassword")
ResponseEntity<JsonObject> validatePassword(String password);
}
@AuthorizedFeignClient(name=“mcpuaa”)
公共接口McpUaaClient{
@后期映射(“/api/auth/validatePassword”)
ResponseEntity validatePassword(字符串密码);
}
我不知道出了什么问题。我设法解决了这个问题,我只需要为我的假客户机实施一个回退。由于Kotlin不支持基本类型,在本例中为“void”,这是一种允许spring cloud避免实现回退的类型,因此我被迫创建一个实现来处理此场景。我成功地解决了这个问题,我只需为我的外部客户端实现回退。由于Kotlin不支持原语类型,在本例中为“void”,这是一种允许SpringCloud避免实现回退的类型,因此我被迫创建一个实现来处理此场景