1.首先对于快捷键:
导包快捷键:Ctrl+Shift+O 自动引导类包
Ctrl+1 快速修复 修改提示(会出现下拉框)
Alt+/ 补全代码(弹出代码提示)
Ctrl+Shift+F 格式化当前代码
Ctrl+Shift+/ 在JSP文件窗口中是 <!--~-->。
Ctrl+/ 在java代码窗口中 对光标所在的一行进行注释 再按则取消注释
Ctrl+Shift+M(先把光标放在需导入包的类名上) 作用是加Import语句
2.maven项目运行报错:
java.sql.SQLException: Unknown system variable 'query_cache_size'
与mysql-connector-java的版本有关(一般是的导入的mysql connector版本过低)
解决:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
3 在maven中org.apache.ibatis.annotations.Param报错的解决办法
.
import org.apache.ibatis.annotations.Param; maven项目中导入这个出错
解决:
第一种方式(问题原因:pom.xml未导入mybtis的配置代码):
<!--MyBatis -->
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.2</version>
</dependency>
第二种方式:
只用在pom.xml中加入以下包就可以
<!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-core -->
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
在maven中org.apache.ibatis.annotations.Param报错的解决办法
原文:https://blog.csdn.net/loveliness_peri/article/details/81158417
第三个方法:
spring整合mybatis的时候,对mybatis的版本是有要求的,:
<--错误,不兼容-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
两个mybatis版本不兼容,把第一个dependency的mybatis版本提高的最新就可以解决这个问题了。改变后的结果如下所示:
<--提高mybatis版本后,正常兼容-->
原文:https://blog.csdn.net/qq_42145871/article/details/81061815
4.mysql的时区错误问题
问题描述:
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
解决:
mysql>show variables like '%time_zone%';
mysql>set global time_zone='+8:00';
执行以上两条即可
详细文章进地址:
https://blog.csdn.net/weixin_39033443/article/details/81711306
5.
报错信息:Loading class `com.mysql.jdbc.Driver'. This is deprecated
(generatorConfiguration中:DriverCLassName(jdbc版本高的话要用): com.mysql.cj.jdbc.Driver
也要在spring的配置文件的数据源配置中修改
)
解决:
https://blog.csdn.net/weixin_42323802/article/details/82500458
6.mybatis逆向工程运行成功却没有生成相应的包下的文件
第一种可能:
mac下路径是./src
windows 路径是.\src
第二种可能: