【JPA】使用@Repository报错,找不到Bean
原创
©著作权归作者所有:来自51CTO博客作者后端研发Marion的原创作品,请联系作者获取转载授权,否则将追究法律责任
一、问题描述
使用@Repository报错
Description:
Field userWriteRepo in com.marion.study.service.UserService required a bean of type 'com.marion.study.repo.write.UserWriteRepo' 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 of type 'com.marion.study.repo.write.UserWriteRepo' in your configuration.
二、问题定位
@Primary
@EnableJpaRepositories(basePackages = "com.marion.study.repo.master",
entityManagerFactoryRef = "entityManagerFactory",
transactionManagerRef = "transactionManager")
public static class writeConfiguration {
}
扫描basePackages不存在,应该是com.marion.study.repo.write