一、问题描述

使用@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