ssm-java学习笔记
- java.lang.NoSuchMethodException: org.cjh.bean.Dept.<init>()
- Invalid bound statement (not found)错误解决方法
- 动态sql if java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
- Failed to determine a suitable driver class
- java.sql.SQLException: No suitable driver found for ${spring.datasource.url}
- IDEA普通项目添加pom.xml,转变为Maven项目
- 恢复rollback了的未commit代码
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
- This may be useful when development is performed under newer SDK version as the target platform for
- Command line is too long. Shorten command line for PhoneTM or also for Application default configuration.
- 用IDEA打开eclipse java maven 项目编译时,出现以下错误:
java.lang.NoSuchMethodException: org.cjh.bean.Dept.()
bean 类缺少无参构造函数,加上无参构造函数即可
或
引入依赖包lombok,添加注解:@Data
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
Invalid bound statement (not found)错误解决方法
1、在resources文件夹下建立子文件使用的分隔符是 “/” ,这和在java文件夹下建立子文件所用的分隔符 “.” 是不一样滴。因此:再建一个文件,使用"com/org/mapper"
2、文件一层层建,不要按照在java目录下一次创建多层目录【会建成单目录文件】
借鉴::https://blog.csdn.net/weixin_46019348/article/details/124854909
动态sql if java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
报错原因:使用了@Data注解,但因为new对象新增了有参构造,没有无参构造
解决:新增无参构造函数解决
或新增注解
@AllArgsConstructor
@NoArgsConstructor
Failed to determine a suitable driver class
新增依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
java.sql.SQLException: No suitable driver found for ${spring.datasource.url}
IDEA普通项目添加pom.xml,转变为Maven项目
https://www.bilibili.com/read/cv13843868/
恢复rollback了的未commit代码
https://blog.csdn.net/m0_46546969/article/details/125458703
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
原因:有重名的类,bean注入失败
This may be useful when development is performed under newer SDK version as the target platform for
解决:在pom.xml 文件中添加一下内容
org.apache.maven.plugins
maven-compiler-plugin
3.6.0
1.8
1.8
Command line is too long. Shorten command line for PhoneTM or also for Application default configuration.
解决:
1. 找到 .idea\workspace.xml
2. 找到<component name="PropertiesComponent">,在里面添加<property name="dynamic.classpath" value="true" />即可
用IDEA打开eclipse java maven 项目编译时,出现以下错误:
Error:(1, 1) java: 非法字符: ‘\ufeff’
Error:(1, 10) java: 需要class, interface或enum
原因:Eclipse可以智能的把UTF-8+BOM文件转为普通的UTF-8文件,IDEA没有这个智能转换。
解决:用IDEA转换,先转换为GBK,再转回UTF-8