[英]Spring Data Project - Couchbase Integration
我遍历了以下通过Spring使用Couchbase数据库的教程
http://projects.spring.io/spring-data-couchbase/#quick-start
我在服务类别中看到以下自动接线。 UserRepository是一个接口。 我假设应该有一个实现此接口的实现,并向其公开了bean。 我看不到任何实现此接口的类或作为bean公开的类。 是否可以帮助解释其工作原理?
@Autowired
public MyService(UserRepository userRepository) {
this.userRepository = userRepository;
}
Spring-Data项目的目的是在您仅定义接口时在运行时为您创建此类实现。
它将检查您配置为通过反射进行扫描的软件包,并在其中发现xxRepository
接口,这时它将使用由您选择的商店特定的Spring Data子项目(在此为Couchbase)提供的基类来编织xxRepository
的具体实现然后注入
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.