springboot 整合mybatis常見錯誤

2021-09-23 20:23:18 字數 985 閱讀 5935

1、找不到sqlsessionfactory

原因:a、mybatis-spring-boot-starter 版本不對,高版本已經不支援自己對inte***ce自動注入

b、spring-boot-starter-parent 版本不對

2、url載入錯誤

原因:

org.springframework.boot.autoconfigure.jdbc.datasourceautoconfiguration 這個類
datasourceautoconfiguration類使用了@configuration註解向spring注入了datasource bean。因為工程中沒有關於datasource相關的配置資訊,當spring建立datasource bean因缺少相關的資訊就會報錯。

解決辦法發是:

@enableautoconfiguration(exclude=)
3、多資料來源的名稱不能為數字

spring:

profiles:

active: dev

datasource:

61test:

name: 61test

url: jdbc:mysql:

username: root

password: zzt88888

driver-class-name: com.mysql.jdbc.driver

#多資料來源的名稱不能為數字

62test:

name: 62

url: jdbc:mysql:

username: root

password: zzt88888

driver-class-name: com.mysql.jdbc.driver

mybatis:

# type-aliases-package: com.fboot.entity

springBoot整合dubbo整合專案

傳統spring 整合dubbo,需要繁瑣的編寫一堆堆的 xml 配置檔案 而springboot整合dubbo後,不在需要寫 xml,通過jar包引用,完 成整合,通過註解的形式完成配置。提高我們的開發效率 目錄結構 1 服務層生產者開發 hs ldm server service 1.1新增du...

SpringBoot整合系列 整合Swagger2

io.springfox springfox swagger2 2.7.0 io.springfox springfox swagger ui 2.7.0 一般無配置項,必要時可以新增自定義配置項,在配置類中讀取 swagger2的配置內容僅僅就是需要建立乙個docket例項 configurati...

SpringBoot整合PageHelper外掛程式

springboot整合pagehelper外掛程式的時候主要分為以下幾步?1.在pom.xml中引入依賴 com.github.pagehelper pagehelper spring boot starter 1.2.3 分頁外掛程式 pagehelper.helperdialect mysql...