spring - NoSuchBeanDefinitionException:没有“java.util.function.Function”类型的限定 bean'
问题描述
@Bean
@ConditionalOnMissingBean
fun storeCertificate(): Function<CacheData, Unit> {
return Function { cacheAndData ->
//CacheAndData is a data class
val (cache, key, cert, duration) = cacheAndData
(cache.nativeCache as? RedisCacheWriter)
?.run { put(CACHE_ISSUER_KEY, key.toByteArray(), ByteUtils.getBytes(cert), duration) }
?: cache.put(key, cert)
}
}
}
在服务中自动装配私有 val storeCertificate:功能
在测试运行期间原因:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有可用的“java.util.function.Function”类型的合格bean:预计至少有1个有资格作为自动装配候选者的bean。依赖注释:{}
解决方案
推荐阅读
- reactjs - React 如何在运行时注入 js 依赖
- css - 停止 shinydashboardPlus 中的右侧边栏隐藏应用程序的主体
- apache-camel - 如果 MQ 不可用,停止骆驼路由
- c - 有没有办法告诉编译器忽略 C 中的某些代码块?
- angular - 浏览器后退按钮默认行为在停止传播时仍在执行
- javascript - 猫鼬心跳和重新连接不起作用
- javascript - 如何使用 Angular JS 过滤器在一个字段中搜索多个值?
- firebase - 我无法添加和删除我的云功能
- python - Python如何在带有条件的列表理解中使用多个for循环
- python - Sqlalchemy 按连续列表中的单个值过滤