目录
- 1
- 标签
- clean install
- 插件
- 代码自动换行
- 多个文件显示在多行tab上
- Ctrl + P 显示方法所需参数
- idea概述
- idea全局搜索
- idea 正则表达式 搜索 替换
- 快捷键
- idea 看代码
- IDEA如何快速查看类中的属性和方法?
- 标签复制多次打开
- 显示某个方法 所有使用它的地方
- 显示类的所有方法
- 显示一个类的父类和子类
- 查找所选内容下一个处位置
- 显示一个类的子类
- 显示一个类的父类 关系图
- maven查看jar包对应的依赖
- idea翻译插件 Translation
- application context not configured for this file
- 快速异常代码 ctrl + alt + t / ctrl + alt + win + t
- ALT+Insert无效
- 快速 有参构造 ALT+Insert
- 自动导包 删除无用包
- idea导包 不自动合并
- idea查看类依赖图
- Error:java: 错误: 不支持发行版本 5
- java.lang.ExceptionInInitializerError
- Controller控制无法跳转至.html页面
- IDEA编译Spring源码每次执行很慢
- idea 运行maven的main函数,出现build
- idea 导入github 代码后应该注意的
- spring调试
- 解决idea包名合并问题
- idea查看方法在哪里被调用的两种技巧
- actions for url
- Unable to open debugger port (127.0.0.1:58937): java.net.BindException "Address already in use: bind"
- Java程序包不存在
- Consider defining a bean of type org.springframework.data.redis.core.RedisTemplate in your configuration
- 断点
- 控制台/ Debug 控制台的 out 窗口不见 的解决办法
- 找不到或无法加载主类com.xxx.xxx.Application
- Failed to introspect Class!
- pom文件 jar冲突解决
- flyway 启动失败
- Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
- Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun.
- maven报错找不到依赖
- idea控制台中文乱码
- jdk17降级至1.8
- 启动
1
jar找对应的依赖
https://blog.csdn.net/weixin_55715292/article/details/124247235
找jar包的依赖
法1
直接 ctrl + shift +f,全局搜索
法2,法1不奏效的话:
法3
标签
https://blog.csdn.net/qq_42796149/article/details/124004963
clean install
mvn clean install
插件
https://www.bilibili.com/video/BV1LH4y1C7He
CodeGlance 滚动条加宽
https://zhuanlan.zhihu.com/p/545234827
CodeGlance 开关快捷键 shift+ctrl+g
Extra ToolWindow Colorful Icons 图标加色
Rainbow Bracket 括号加色
Background Image Plus,idea 背景加图片
Maven Helper插件 - Dependency Analyzer
分析工程的多级依赖关系,解决依赖冲突问题
SequenceDiagram
方法的时序图
https://zhuanlan.zhihu.com/p/441178281
代码自动换行
https://blog.csdn.net/y_bccl27/article/details/121681777
多个文件显示在多行tab上
https://blog.csdn.net/With_Her/article/details/82254187
Ctrl + P 显示方法所需参数
idea概述
https://www.cnblogs.com/TopGear/p/13590301.html
https://blog.csdn.net/qq_35495339/article/details/89474932
idea全局搜索
idea 正则表达式 搜索 替换
参考于 https://blog.csdn.net/qq_34039018/article/details/106013732
搜索
<d.*y>
= <d开头 y结尾的 字符串>
替换
https://blog.csdn.net/qq_42274245/article/details/122953877
\w*,
= qwe,
= qw,
(\w*),
中\w*
作为元素1 = $1
快捷键
https://xie.infoq.cn/article/b71b00851b324c866045a84f5
代码规范 alt+ctrl+L 格式化代码
ALT + 7 打开左侧的 Structure 查看当前类中的所有方法
固定tab
https://webstorm.github.net.cn/using-code-editor.html#manage_tabs
idea自动生成serialVersionUID
1、搜索serialVersionUID
2、安装插件 GenerateSerialVersionUiD
在对应类名中 alt + enter
idea 看代码
https://www.cnblogs.com/deng-cc/p/6927447.html
IDEA如何快速查看类中的属性和方法?
https://blog.csdn.net/song_6666/article/details/123860757
标签复制多次打开
shift + f4
显示某个方法 所有使用它的地方
选中该方法 → ctrl + alt +h
显示类的所有方法
ctrl +F12
显示一个类的父类和子类
ctrl + h
查找所选内容下一个处位置
ctrl+F3
显示一个类的子类
ctrl + alt + 左键
显示一个类的父类 关系图
ctrl + alt + shift + u
ctrl + H:查询子接口、实现类
ctrl + alt + 鼠标左键:查看实现类
其他操作(重要)
https://blog.csdn.net/woniu211111/article/details/108591368
ctrl+alt+B:选中某个子类,那么就可以将该子类添加到类图中
来源:
https://blog.csdn.net/luoyifan_33/article/details/111576218
https://www.yht7.com/news/98982
实线 虚线的含义
https://blog.csdn.net/wglla/article/details/52225571
实线箭头:
实线的 空心三角箭头:继承(泛化) - 某个类引用了另一个类
实线 箭头:关联 - 类的全局变量引用了另一个类
实线的 空心菱形箭头(也可以没箭头):聚合 - 整体和个体的关系 = 关联,整体与个体有各自的生命周期
实线的 实心菱形箭头(也可以没箭头):组合 - 整体与部分的关系 ,部分与整体的生命周期一致
虚线:
虚线的 空心三角箭头:实现 - 类与接口的关系
虚线 箭头:依赖 - 方法参数需要传入另一个类的对象
idea编辑器 全集搜索快捷键 Ctrl+shift+f 无效
https://blog.csdn.net/u010234868/article/details/124879486
maven查看jar包对应的依赖
jar名 反推 pom依赖
https://blog.csdn.net/londa/article/details/117906300
https://blog.csdn.net/weixin_45837888/article/details/128574711
打开Terminal,mvn dependency:tree
idea翻译插件 Translation
使用 https://yiiguxing.gitee.io/translation-plugin/start.html
application context not configured for this file
解决:
ok
快速异常代码 ctrl + alt + t / ctrl + alt + win + t
ALT+Insert无效
笔记本会有这个问题
原因是键Fn
Fn+ALT+Insert就好了
因为我的Insert是F12键,需要和Fn一起按 才起作用
快速 有参构造 ALT+Insert
ALT+Insert:
自动导包 删除无用包
如果不能自动删除包,再试试:
idea导包 不自动合并
https://www.cnblogs.com/pcheng/p/10268366.html
idea查看类依赖图
https://blog.csdn.net/qq_32599217/article/details/98209325
Error:java: 错误: 不支持发行版本 5
解决:
来源:https://blog.csdn.net/qq_22076345/article/details/82392236
java.lang.ExceptionInInitializerError
com.sun.tools.javac.code.TypeTags
网上搜索,其原因是 lombok 版本太低
但 pom 文件中,根本找不到 lombok …
Controller控制无法跳转至.html页面
在Controller中错误Cannot resolve MVC view ‘xxx’
解决:
https://blog.csdn.net/weixin_45655079/article/details/116258225
IDEA编译Spring源码每次执行很慢
法1:
https://www.pianshen.com/article/84181976795/
法2:
https://blog.csdn.net/weixin_42180169/article/details/120458985
idea 运行maven的main函数,出现build
https://blog.csdn.net/qq_43349112/article/details/111378395
idea 导入github 代码后应该注意的
spring调试
https://www.bilibili.com/video/BV1EC4y1h7Nf
idea代码自动换行
解决idea包名合并问题
https://blog.csdn.net/weixin_43493397/article/details/120268164
idea查看方法在哪里被调用的两种技巧
https://www.jb51.net/softjc/746017.html
alt + f7:
find usages选项,意思是"找到使用它的地方
ctrl+alt+h:
alt+f7的结果是 由大到小的层次,结果的树形结构是 模块->包->类->方法->行
ctrl+alt+h的搜索结果的结构是 目标方法->调用目标方法的方法a->调用a的方法b……这样的结构
actions for url
有3个选项
第1个:
第2个
第3个
Unable to open debugger port (127.0.0.1:58937): java.net.BindException “Address already in use: bind”
tasklist|findstr 58937
netstat -aon |findstr "58937"
taskkill -pid 16728 -f
windows无法终止PID的进程,拒绝访问的原因:
没有以 cmd 管理员身份进去
Java程序包不存在
https://blog.csdn.net/Pan_peter/article/details/126774921
Consider defining a bean of type org.springframework.data.redis.core.RedisTemplate in your configuration
https://zhuanlan.zhihu.com/p/533576774
法1:项目的Application启动文件,用@MapperScan注解,把当前的路径引用进去
法2:在相应的 @Autowired(required = false)
断点
idea 打不了断点
重启 idea 就行了
控制台/ Debug 控制台的 out 窗口不见 的解决办法
https://blog.csdn.net/HeatDeath/article/details/78460957
找不到或无法加载主类com.xxx.xxx.Application
https://blog.csdn.net/qq_53314126/article/details/118939259
clean + install
Failed to introspect Class!
https://blog.csdn.net/weixin_36340771/article/details/103592851
pom 依赖中 有版本冲突
pom文件 jar冲突解决
https://blog.csdn.net/kevin_mails/article/details/85342066
报错1
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
报错2
Factory method ‘resourceHandlerMapping’ threw exception; nested exception is java.lang.IllegalStateException: No ServletContext set
报错3
xception encountered during context initialization - cancelling refresh atte
报错4
Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
报错5
Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
报错6
Failed to introspect Class!
https://blog.csdn.net/weixin_36340771/article/details/103592851
解决:pom 依赖中 有版本冲突
问题7:
发现bean注入不进来
https://www.cnblogs.com/chenyanbin/p/12495630.html
解决办法:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-starter-web.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
jetty 和 tomcat 类似
flyway 启动失败
一般看 migration 的文件前缀是否重叠
或者把本地对应数据表删除重新初始化
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
问题:
先写我的解决办法:
修改 tomcat 的版本号就行,9.0.xx才行,比它高的版本会报错missing ServletWebServerFactory bean
<tomcat-embed-core.version>9.0.71</tomcat-embed-core.version>
<tomcat-embed-el.version>9.0.71</tomcat-embed-el.version>
其他办法:
https://blog.csdn.net/weixin_44299027/article/details/113590189
// 1
类忘记添加 @SpringBootApplication
//2
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
//3
main方法写错
就是把SpringApplication.run(XxxApplication.class,args);
写成了SpringApplication.run(SpringApplication.class,args);
//4
<!-- 这里指定打war包的时不再需要tomcat相关的包,但是本地运行时必须注释掉,否则会报错 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- 这里指定打war包的时不再需要tomcat相关的包,但是本地运行时必须注释掉,否则会报错 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provide</scope>
</dependency>
// 5
移除排除项
Command line is too long. Shorten the command line via JAR manifest or via a classpath file and rerun.
https://www.baeldung.com/intellij-idea-command-line-is-too-long
https://cloud.tencent.com/developer/article/1751411
maven报错找不到依赖
org.springframework.boot:spring-boot-starter-parent:
pom:3.1.8 was not found in
https://maven.cloudartifact.lfg.dragon.tools.huawei.com/artifactory/Product-Public-Service/ during a previous attempt.
This failure was cached in the local repository and resolution
is not reattempted until the update interval of cbu-2rd has elapsed or updates are forced
解决方案:
https://zhuanlan.zhihu.com/p/80250166
清理或备份repository的缓存的库至别的地方即可
idea控制台中文乱码
参考
https://blog.csdn.net/weixin_51942352/article/details/127718876
https://developer.aliyun.com/article/947746
https://www.jianshu.com/p/f87b6301d668
以下都设置为utf-8:
1
2
3
-Dfile.encoding=UTF-8
4
5 本地tomcat设置:
jdk17降级至1.8
背景:本地开发使用jdk17,测试和生产环境的jdk是1.8,结果jar启动异常
jdk17换为1.8后 install → 无效的标记: --release
报错1 无效的标记: --release
报错2 A JNI error has occurred, please check your installation and try again
https://www.cnblogs.com/tszr/p/16185134.html
https://blog.csdn.net/xiang0731/article/details/87973131
解决方法:
idea的jdk全换位1.8 + 本地jdk版本换为1.8
idea的jdk全换位1.8
1
2
3
4
5
报错3 类文件具有错误的版本 61.0, 应为 52.0
https://blog.csdn.net/simonchi/article/details/126625381
xml spring依赖由3降为2.7.7
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
启动
启动前自动 clean install
spring boot:
clean install -Dmaven.test.skip=true -Ptomcat,dev,!production -U -gs settings.xml
tomcat:
clean install -Dmaven.test.skip=true -Ptomcat,dev,!production -U -gs settings.xml