您的位置: 首页 > 文章 > springDataJpa学习之Consider defining a bean of type ‘类名‘ in your your configuration.错误(已解决) springDataJpa学习之Consider defining a bean of type ‘类名‘ in your your configuration.错误(已解决) 分类: 文章 • 2024-01-22 21:25:34 在启动类加上 @EntityScan(“com.motaoyu.spring.data.jpa.entity”) @EnableJpaRepositories(“com.motaoyu.spring.data.jpa.dao”) 两个注解,前一个是扫描entity,后面是扫描dao,这样在其他地方使用dao的时候能够自动注入。没有这两个注解就会出现如上图错误。 谢谢博主:http://www.tocs.cn/article/16