springboot使用jpa啟動報錯consider defining a bean of type '*.*.**Repository' in your configuration....
@EntityScan("com.miying.entity")
@EnableJpaRepositories("com.miying.dao")
public class BaseApplication {
public static void main(String[] args) {
SpringApplication.run(BaseApplication.class, args);
}
}
在啟動類加上@EntityScan("com.miying.entity")
和@EnableJpaRepositories("com.miying.dao")
兩個註解,前一個是掃描entity,後面是掃描repository,這樣在其他地方使用repository的時候能夠自動注入。沒有這兩個註解就會出現如下圖錯誤。
相關文章
- spring注入在有常量的情況下使用@AllArgsConstructor報錯Consider defining a bean of type ‘java.lang.String‘ in your cSpringStructIDEBeanJava
- springboot專案啟動報錯Spring Boot
- spring配置檔案中配置了,但找不到Bean , 啟動不報錯,執行報錯No bean namedSpringBean
- SpringBoot使用JPASpring Boot
- springboot 專案引入tk或者jpa 訪問報錯Spring Boot
- JPA Repository之JpaRepositoryImplementation
- Vuex中使用報錯unknown mutation typeVue
- 使用root使用者啟動hadoop報錯Hadoop
- mongodb 啟動報錯MongoDB
- php啟動報錯PHP
- SpringBoot 中 JPA 的使用Spring Boot
- springboot註解實現非同步呼叫時no bean of type TaskExecutor and no bean named 'taskExecutor' eitherSpring Boot非同步Bean
- golang使用sqlx報錯:unsupported type []interface {}, a slice of interfaceGolangSQL
- myeclipse啟動報錯Eclipse
- 本地nacos啟動報錯
- jpa報錯 Failed to initialize JPA EntityManagerFactory: Unable to instantiate default tuplizerAI
- @FeignClient @Resource 無法注入Bean Springboot無法啟動clientBeanSpring Boot
- Springboot專案啟動後訪問Controller報錯404Spring BootController
- SAP為Storage Type 004啟用SUM報錯 - Storage types without pick-point stor.type
- Springboot啟動了哪些bean?這兩種方式可以獲取Spring BootBean
- Homestead 啟動 elasticsearch 報錯Elasticsearch
- apache啟動報錯:httpd: aprApachehttpd
- laravel sail 首次啟動報錯LaravelAI
- sqlplus 啟動報錯SQL
- 啟動ASM 例項報錯ASM
- SpringBoot整合Junit單元測試找不到bean報錯:expected at least 1 bean which qualifies as autowire candidateSpring BootBeanAST
- Idea啟動SpringBoot報錯:程式包xxx 不存在IdeaSpring Boot
- Springboot 啟動時不報錯一直卡住,{dataSource-1} initedSpring Boot
- springboot(五):spring data jpa的使用Spring Boot
- Mac 上啟動 appium 報錯MacAPP
- mongodb啟動報錯怎麼辦MongoDB
- Centos7啟動Nginx報錯。CentOSNginx
- Apache Hive啟動報NoClassDefFoundError錯誤ApacheHiveError
- Qt 報錯 “類名”does not name a typeQT
- React報錯之Element type is invalidReact
- sourcetree github clone 報錯 hg clone fails with “repository not found“GithubAI
- std::unique_ptr使用incomplete type的報錯分析和解決
- zabbix-server啟動報錯解決Server