谢谢,我忘记了这个多模块问题!
但是在指定(非重叠)模块之后:
@EnableJpaRepositories("com.brainflow.brainflowserver.repositories")
@EnableR2dbcRepositories("com.brainflow.brainflowserver.reactiveRepos")
class BrainflowServerApplication {
(注意:com.brainflow.brainflowserver.reactiveRepos 目前是一个空文件夹)
它仍然会触发错误
Parameter 0 of constructor in com.brainflow.brainflowserver.services.UserService required a bean named 'entityManagerFactory' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean named 'entityManagerFactory' in your configuration.
所以我认为 @EnableJpaRepositories("com.brainflow.brainflowserver.repositories") 禁用了 spring boot JPA autoconf,破坏了实体管理器,但是当我指定 jpa 模块并删除 r2dbc 依赖项时没有问题。
编辑:你对日志的看法是正确的
Multiple Spring Data modules found, entering strict repository configuration mode!
Bootstrapping Spring Data JPA repositories in DEFAULT mode.
Finished Spring Data repository scanning in 46 ms. Found 9 JPA repository interfaces.
Multiple Spring Data modules found, entering strict repository configuration mode!
Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
Finished Spring Data repository scanning in 0 ms. Found 0 R2DBC repository interfaces.
Multiple Spring Data modules found, entering strict repository configuration mode!
Bootstrapping Spring Data R2DBC repositories in DEFAULT mode.
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Spring Data R2DBC - Could not safely identify store assignment for repository candidat
Finished Spring Data repository scanning in 16 ms. Found 0 R2DBC repository interfaces
Multiple Spring Data modules found, entering strict repository configuration mode!
Bootstrapping Spring Data Redis repositories in DEFAULT mode.
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Spring Data Redis - Could not safely identify store assignment for repository candidat
Finished Spring Data repository scanning in 7 ms. Found 0 Redis repository interfaces.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.BrainflowRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.LinkRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.NodeRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.ProjectMemberRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcReposit
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.ProjectRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.RequestRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.TagRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.UserNodeRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.RepositoryConfigurationExtensionSupport : Spring Data R2DBC - Could not safely identify store assignment for repository candidate interface com.brainflow.brainflowserver.repositories.UserRepository. If you want this repository to be a R2DBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table (preferred), or consider extending one of the following types with your repository: org.springframework.data.r2dbc.repository.R2dbcRepository.
.s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16 ms. Found 0 R2DBC repository interfaces.
我不明白为什么 R2DBC spring 查看存储库模块,我明确告诉 spring 仅查看反应模块 @EnableR2dbcRepositories("com.brainflow.brainflowserver.reactiveRepos")
编辑添加 @EnableRedisRepositories("com.brainflow.brainflowserver.repositories") 不能解决问题