Springboot+Mybatis:啟動報錯 String index out of range: -37
阿新 • • 發佈:2021-06-23
springBoot+Druid+Mybatis :啟動錯誤描述
Error parsing SQL Mapper Configuration. Cause: java.lang.StringIndexOutOfBoundsException: String index out of range: -37
1.UnsatisfiedDependencyException
可能原因之一,這個專案目錄有中文:
1.專案目錄有資料夾是中文
2.專案所屬的層級內外層級有中文
解決簡易:將整個專案複製到純英文目錄下,且保證專案內所有檔案都是純英文名稱。IDEA重新匯入開啟
原來我的專案內部全部檔案都是純英文的,但是啟動還是錯,我查看了專案所在的Windows系統檔案位置:G:\谷歌下載\JSP原始碼\xxxx;發現他的外層是中文目錄,於是截切專案到F:\WEBProject\Demohander\xxxx;在IDEA中刪除之前的專案,開啟新目錄下的這個專案,再次啟動就沒問題了。
整合Durid時也出現了問題:
<!--德魯伊資料庫連線池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.6</version>
</dependency>
Spring Boot 報錯org.springframework.jdbc.datasource.embedded.EmbeddedData
解決方式:
- 新增:@EnableAutoConfiguration(exclude = {DruidDataSourceAutoConfigure.class})
- 新增依賴:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>