国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

springboot 沒法掃描到repository的解決

瀏覽:4日期:2023-03-27 09:17:08

sprint boot2.0啟動的時候報錯!

A component required a bean of type ’XXX’ that could not be found.

就是沒有掃描到我的repository包里的代碼

我先用@ComponentScan注解加上類所在的包名,沒有報錯,可以正常啟動

但是坑爹的是@RestController注解下的Controller層的代碼沒有掃描到

就是說http://127.0.0.1:8080可以正常訪問,但是Controller層配置的@RequestMapping都匹配不到

折騰了好久好久,比如@ComponentScan在加上Controller層的包名還是不行(導致repository包掃描不到),使用包名.*模糊匹配也不行,好坑爹,說好的比spring mvc配置要簡單的呢

最后我盯上了@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)注解

這個是因為最開始的時候項目啟動報錯沒有數據庫相關配置

然后我刪掉了注解里的exclude,開始加上一些數據庫配置,比如

spring.datasource.url=jdbc:mysql://xxx.x.x.x/favorites?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=truespring.datasource.username=rootspring.datasource.password=rootspring.datasource.driver-class-name=com.mysql.jdbc.Driver

這里的數據庫不是我本機的數據庫,但是日志一直是報錯連接的是連接我的本地數據庫失敗

報錯信息里查了一下DataSourceConfiguration這個類,猜測是配置的數據庫連接失敗之后開始連接localhost的數據庫

然后加上了hikari的一些配置就能正常啟動,連接我配置的數據庫,查詢sql都正常了

spring.datasource.type=com.zaxxer.hikari.HikariDataSourcespring.datasource.hikari.minimum-idle=5spring.datasource.hikari.maximum-pool-size=15spring.datasource.hikari.auto-commit=truespring.datasource.hikari.idle-timeout=30000spring.datasource.hikari.pool-name=DatebookHikariCPspring.datasource.hikari.max-lifetime=1800000spring.datasource.hikari.connection-timeout=30000spring.datasource.hikari.connection-test-query=SELECT 1

定位過程真的是好心累!

補充:今天安裝spring的時候遇到一些缺少repository的問題

在安裝spring的時候會對其依賴的一些庫的進行一些鏈接檢查,導致會報一些缺少repository的問題

No repository found containing: osgi.bundle,oracle.eclipse.tools.rest.lib,16.4.0.201705251324No repository found containing: osgi.bundle,org.eclipse.cft.server.core,1.2.3.v201709130027No repository found containing: osgi.bundle,org.eclipse.cft.server.rse,1.0.1.v201709130027No repository found containing: osgi.bundle,org.eclipse.cft.server.standalone.core,1.0.4.v201709130027No repository found containing: osgi.bundle,org.eclipse.cft.server.standalone.ui,1.0.4.v201709130027No repository found containing: osgi.bundle,org.eclipse.cft.server.ui,1.0.110.v201709130027

stackvoerflow上找到了對應的問題和解決方案:地址

解決方法:

Go to Help → Install new software → Here uncheck “Contact all update sites during install to find required software”

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。如有錯誤或未考慮完全的地方,望不吝賜教。

標簽: Spring
相關文章:
主站蜘蛛池模板: 美女很黄很黄是免费的·无遮挡网站 | 久草手机在线观看视频 | 欧美亚洲日本一区二区三区浪人 | 一区二区成人国产精品 | 美国美女一级毛片免费全 | 久久视频在线免费观看 | 天堂8中文在线最新版在线 天堂8资源8在线 | 国产成人精品亚洲 | 亚洲国产欧美精品 | 欧美人成片免费看视频不卡 | wwwxx在线| 在线成人国产 | 欧美第一精品 | 夜色www国产精品资源站 | 国产成人看片免费视频观看 | 黄色毛片免费 | 中文字幕一级片 | 一级黑人 | 欧美一级片网址 | 5级做人爱c视版免费视频 | 精品一区二区三区中文字幕 | 精品女厕沟底拍撒尿 | 日本韩国三级在线 | 中文字幕 亚洲精品 | 日本手机看片 | 毛片一级 | 久久久久久久久久毛片精品美女 | 国产高清在线精品一区二区三区 | 香蕉久久a毛片 | 亚洲一区二区三区不卡视频 | 久久国产精品久久 | 99久9在线视频 | 99re思思 | 亚洲成人免费在线观看 | 一区二区三区在线免费看 | 黑人一级片 | 欧美特级午夜一区二区三区 | 欧美国产亚洲一区 | 国产午夜精品久久理论片 | 国产精品久久久久影院色老大 | 国产性生活视频 |