mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 17:48:25 +08:00
doc: update docs
This commit is contained in:
parent
4abcb13f61
commit
6c0927ffff
@ -1,5 +1,7 @@
|
|||||||
# 常见问题
|
# 常见问题
|
||||||
|
|
||||||
|
[[toc]]
|
||||||
|
|
||||||
## MyBatis-Flex 没有启动或者启动出错怎么办?
|
## MyBatis-Flex 没有启动或者启动出错怎么办?
|
||||||
|
|
||||||
正常情况下,MyBatis-Flex 在启动时,会在控制台打印如下 Banner 信息,包含版本与官方网址,如果在项目启动中没有发现 MyBatis-Flex 的 Banner 打印,那就说明 MyBatis-Flex 没有被正常加载。
|
正常情况下,MyBatis-Flex 在启动时,会在控制台打印如下 Banner 信息,包含版本与官方网址,如果在项目启动中没有发现 MyBatis-Flex 的 Banner 打印,那就说明 MyBatis-Flex 没有被正常加载。
|
||||||
@ -94,6 +96,18 @@ SpringBoot v3.x 添加 hikariCP 的内容如下:
|
|||||||
|
|
||||||
> 如果使用的是 druid 数据库连接池,则需要添加数据源类型的配置 `spring.datasource.type=com.alibaba.druid.pool.DruidDataSource`。
|
> 如果使用的是 druid 数据库连接池,则需要添加数据源类型的配置 `spring.datasource.type=com.alibaba.druid.pool.DruidDataSource`。
|
||||||
|
|
||||||
|
## SpringBoot 项目中出现 class "com.xxx" cannot be cast class "com.xxx" 的错误
|
||||||
|
这个问题是由于 Spring 的 devtools 热加载引起的,可以在项目的 `resources/META-INF`
|
||||||
|
目录下创建一个名为 `spring-devtools.properties` 的配置文件,配置内容如下:
|
||||||
|
|
||||||
|
```properties
|
||||||
|
restart.include.mapper=/mapper-[\\w-\\.].jar
|
||||||
|
restart.include.pagehelper=/pagehelper-[\\w-\\.].jar
|
||||||
|
restart.include.mybatis-flex=/mybatis-flex-[\\w-\\.]+jar
|
||||||
|
```
|
||||||
|
相关文档参考 Spring 的官方网站:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.devtools.restart.customizing-the-classload
|
||||||
|
|
||||||
|
|
||||||
## java.sql.SQLException: No value specified for parameter x
|
## java.sql.SQLException: No value specified for parameter x
|
||||||
出现这个问题,原因是 MyBatis-Flex 未能正常启动,SQL 执行没有经过 MyBatis-Flex 导致的。其直接是因为和其他第三方增强框架整合使用了,
|
出现这个问题,原因是 MyBatis-Flex 未能正常启动,SQL 执行没有经过 MyBatis-Flex 导致的。其直接是因为和其他第三方增强框架整合使用了,
|
||||||
比如和 MyBatis-Plus、或者 PageHelper 等整合造成的。
|
比如和 MyBatis-Plus、或者 PageHelper 等整合造成的。
|
||||||
@ -177,6 +191,20 @@ spring:
|
|||||||
|
|
||||||
如果是 MySQL 数据库的话,可能是因为数据库版本太低,解决办法:MySQL 5.* 需要在 jdbcUrl 设置参数 `useInformationSchema=true` 才能获取到注释。
|
如果是 MySQL 数据库的话,可能是因为数据库版本太低,解决办法:MySQL 5.* 需要在 jdbcUrl 设置参数 `useInformationSchema=true` 才能获取到注释。
|
||||||
|
|
||||||
|
例如:`jdbc:mysql://127.0.0.1:3306/mybatis-flex?characterEncoding=UTF-8&useInformationSchema=true`
|
||||||
|
|
||||||
|
## 与 Nacos 集成时出错,无法正常启动 MyBatis-Flex
|
||||||
|
|
||||||
|
一般请看下是缺少 Nacos 的相关 Maven,注意添加如下的 Nacos 依赖:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
<version>2022.0.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
## 如何自定义 MyBatis 的 Configuration?
|
## 如何自定义 MyBatis 的 Configuration?
|
||||||
|
|
||||||
1、在不使用 Spring 的场景下:
|
1、在不使用 Spring 的场景下:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user