在启动类加上
@EntityScan(“com.motaoyu.spring.data.jpa.entity”)
@EnableJpaRepositories(“com.motaoyu.spring.data.jpa.dao”)
两个注解,前一个是扫描entity,后面是扫描dao,这样在其他地方使用dao的时候能够自动注入。没有这两个注解就会出现如上图错误。
谢谢博主:http://www.tocs/article/16
更多推荐
springDataJpa学习之Consider defining a bean of type ‘类名‘ in your your configuration
发布评论