idea总结

一、关闭注释折叠

1.1、现象

1.2、解决方法

File ==> Settings ==> General ==> Apperance ==> 取消勾选Render documention comments;

1.3、效果

1.4、参考

https://blog.youkuaiyun.com/ibigboy/article/details/129258800

二、忽略提交部分文件

.idea
.mvn
.mvnw
mvnw
mvnw.cmd
*.iml
HELP.md

三、新建Java文件时,自动生成作者信息

File ==> Settings ==> Editor ==>File and Code Templates ==> Includes ==> File Header

/**
 * @Author : 一叶浮萍归大海
 * @Date: ${DATE} ${TIME}
 * @Description: 
 */    

四、新版Idea(2022)的Git不显示local代码

4.1、现象

4.2、解决方法

File==》Settings==》Version Control==》Commit==》取消勾选第一项

五、全局配置

5.1、全局maven配置

IDEA启动页面 ==> Customize ==> All settings ==> Build,Execution,Deployment ==> Build Tools ==>Maven

5.2、全局编码配置

IDEA启动页面 ==> Customize ==> All settings ==>Editor ==> File Encodings

5.3、全局注解生效激活

IDEA启动页面 ==> Customize ==> All settings ==> Build,Execution,Deployment ==> Compiler ==> Annotation Processors ==> Enable annotation processing

5.4、全局激活DevTools配置

IDEA启动页面 ==> Customize ==> All settings ==> Build,Execution,Deployment ==> Compiler

5.5、全局Java编译版本配置

IDEA启动页面 ==> Customize ==> All settings ==> Build,Execution,Deployment ==> Compiler ==> Java Compiler

5.6、全局File Types过滤

六、Live Templates

6.1、fast

fast 
 
快速在类上添加注解
 
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@ToString(callSuper = true)

6.2、getThreadName

getThreadName
 
 
快速获取当前线程的名字
 
 
Thread.currentThread().getName()

6.3、info

info
 
快速打印log日志
 
 
log.info(" result:{}", result);

6.4、infoj

infoj
 
快速打印json日志
 
log.info(" result:{}", JSON.toJSONString(result));

6.5、infopj

infopj
 
 
快速打印Controller层的参数
 
 
log.info(" param:{}", JSON.toJSONString(param));

6.6、mainb

mainb
 
快速生成springboot主启动类的main方法
 
public static void main(String[] args) {
    SpringApplication.run(.class, args);
}

6.7、msb

msb
 
在Springboot的主启动类上快速添加注解
 
 
@MapperScan(basePackages = "org.star.mapper")
@SpringBootApplication

6.8、sdf

sdf
 
快速生成格式化日期
 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

6.9、sst

sst
 
在Springboot的测试类上快速添加注解
 
@Slf4j
@SpringBootTest

6.10、tryc

tryc
 
快速生成try...catch代码块
 
try {
            
} catch (Exception e) {
    
}


6.11、trycf

trycf
 
快速生成try...catch...finally代码块
 
 
try {
                    
} catch (Exception e) {
    
} finally {
    
}

6.12、tryf

trycf
 
快速生成try...catch...finally代码块
 
 
try {
                    
} catch (Exception e) {
    
} finally {
    
}

6.13、threadfor40

threadfor10
 
快速生成10个线程
 
for (int i = 1; i <= 10; i++) {
    new Thread(() -> {
 
    }, String.valueOf(i)).start();
}

6.14、threadNew

threadNew
 
快速创建一个线程
 
new Thread(() -> {
	try {
		
	} catch (Exception e) {
		e.printStackTrace();
	}
}, "线程名字").start();

6.15、threadSleepTimeUnit

threadSleepTimeUnit
 
线程快速休眠(单位:秒)
 
// 线程休眠(单位:秒)
try { TimeUnit.SECONDS.sleep(4); } catch (Exception e) {e.printStackTrace();}

6.16、noArgs

noArgs
 
快速打印无参构造方法被调用了
 
System.out.println("xxx's NoArgsConstructor was invoked!");

6.17、allArgs

allArgs
 
快速打印有参构造方法被调用了
 
System.out.println("xxx's AllArgsConstructor was invoked!");

6.18、initJVMParams

initJVMParams
 
快速打印jvm的配置信息
 
-Xms10m -Xmx10m -XX:+PrintGCDetails

6.19、lock.lock

lock.lock
 
快速生成JUC lock代码块
 
lock.lock();
try {
	// do your business...
} catch (Exception e) {
	e.printStackTrace();
} finally {
	lock.unlock();
}

6.20、threadFor40Group

threadFor40Group
 
快速生成一组同名的线程
 
new Thread(() -> {
	for (int i = 1; i <= 40; i++) {
		
	}
},"线程名字").start();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值