編寫api介面遇到的問題
阿新 • • 發佈:2018-11-28
問題一: 搭建springboot+mybatis時,報出錯誤:
“java.lang.IllegalArgumentException: Property 'sqlSessionFactory'”
解決辦法:1、依照順序“實體類,dao,impl,資料實現層,控制層”來排錯,檢查並改正;
2、檢視依賴是否注入成功,補齊所需的jar包,編譯
3、檢視執行類Application.java,如下:
package com.*.*; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; @SpringBootApplication(scanBasePackages = {"com.*.*"}) @MapperScan("com.*.*.dao") public class ApidemoApplication { public static void main(String[] args) { SpringApplication.run(ApidemoApplication.class, args); } }