Java 启用数据jpa dep时注入存储库的问题

Java 启用数据jpa dep时注入存储库的问题,java,spring,spring-data-jpa,spring-data,spring-data-jdbc,Java,Spring,Spring Data Jpa,Spring Data,Spring Data Jdbc,我注意到,我一对JPA dep发表评论,见下文: implementation("org.springframework.boot:spring-boot-starter-jdbc") implementation ("org.springframework.boot:spring-boot-starter-data-jdbc") //implementation ("org.springframework.boot:spring-boot-starter-data-jpa") I do not

我注意到,我一对JPA dep发表评论,见下文:

implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation ("org.springframework.boot:spring-boot-starter-data-jdbc")
//implementation ("org.springframework.boot:spring-boot-starter-data-jpa")
I do not have any @Entity annotated classes in my code.
我在开始时出错:

The bean 'myRepository', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
事实上,我在开始的时候,我的所有存储库都出现了这个错误,它只是在第一次失败时,它无法启动和停止。也就是说,我实际上没有在存储库中进行复制的风险

我使用:
id'org.springframework.boot'version'2.2.0.RELEASE'
version

我对项目进行了
gradlew clean build
,以确保没有任何剩余

我的存储库类是:

public interface MyRepository extends CrudRepository<MyModel, UUID> {

    @Query(rowMapperClass = MyModelRowMapper.class, value = "select my_uuid, my_code from my_model_table")
    Iterable<MyModel> findMyStuff();
}
如果我保留
springbootstarter数据jpa
注释,所有这些都可以工作

不知道是有虫子还是我还在

我拿到了我的

@Configuration
@EnableJdbcRepositories
public class RepositoryConfig {
}
与所有存储库位于同一个包中


毕竟,如果我不包括jpa,它是有效的。我的代码中还没有任何JPA特定的代码。

您需要确保不同的存储库仅由正确的Spring数据模块处理,方法是将它们和相应的
@enablexrepositories
注释移动到单独的包中,或者为注释提供适当的过滤器

否则,Spring Data将尝试创建错误类型的存储库,这将失败,例如,因为找不到匹配的
@Id
注释。

如果我创建一个文件夹“jdbc”,请将带有@enablejdbc存储库的config类放在那里,并将我的所有数据jdbc存储库移到“一个模块中”。我仍然有同样的例外。如果从集成测试运行。
@Configuration
@EnableJdbcRepositories
public class RepositoryConfig {
}