【spring-mybatis整合问题汇总】

Invalid bound statement (not found)....

检查properties文件:

mybatis.typeAliasesPackage=com.test.shiro.entity

mybatis.mapperLocations=classpath:mapper/*.xml

连接MySQL数据库报时区错误:java.sql.SQLException: The server time zone value

检查properties文件:

在连接mysql的JDBC的url后面加上服务器的时区:serverTimezone=UTC即可。

例:spring.datasource.url=jdbc:mysql://localhost:3306/smntest?characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=UTC

Failed to configure a DataSource: 'url' attribute is not specified

检查properties文件:

spring.datasource.url看属性形式是不是都是这种形式,例如自己定义的db.properties就不会被识别

Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation

pom.xml中加入:

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.1.1</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/qq_39082699/article/details/97143930