idea 相关

常用配置

maven 相关

新建maven巨慢

在这里插入图片描述

-DarchetypeCatalog = internal

跳过测试

在这里插入图片描述
此时已然需要编译测试类,如果需要编译时跳过测试类,可以:

mvn install -Dmaven.test.skip=true

或者

<plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
</plugins>

自身配置

显示运行时占用内存

旧版本;
在这里插入图片描述
新版本:
方法一:
双击shift,搜索show memory indicator
打开后重启,右下角显示IDEA内存占用情况
在这里插入图片描述
方法二:
在这里插入图片描述

不打开上次项目

settings->Appearance & Behavior -> System Settings 取消 Reopen last project on startup

这里写图片描述

properties 文件编码

在这里插入图片描述

隐藏文件

File->Settingss->Editor->File Types
找到.ignore
添加 .idea; *.iml
在这里插入图片描述

编辑器

背景色

settings -> Editor -> Color Schema -> General -> Text -> Default text 修改 Background

这里写图片描述

缩进线与右侧80列线

颜色
settings -> Editor -> Color Schema -> General -> Editor ->Guides
Hard wrap guide : 右侧线颜色
Indent guide : 缩进线 颜色
这里写图片描述

位置
settings -> Editor -> Code Style -> Hard wrap at

这里写图片描述

mapper xml 颜色

步骤一
Settings -> Editor -> Inspections -> SQL
取消勾选:No data sources configured 和 SQL dialect detection
这里写图片描述
步骤二
在这里插入图片描述

spring 等提示

mapper 报错

方法一:
在这里插入图片描述
方法二:
直接将@Autowired换成@Resource注解,此注解是JDK中的注解,不会向@Autowired那样去Spring容器中寻找bean

Field injection is not recommended

方法一:
在这里插入图片描述
方法二:

spring 官方推荐

private final ProductCateLogic productCateLogic;

@Autowired
public ProductCateController(ProductCateLogic productCateLogic) {
    this.productCateLogic = productCateLogic;
}

方法三:

private ProductCateLogic productCateLogic;

@Autowired
public void setProductCateLogic(ProductCateLogic productCateLogic) {
    this.productCateLogic = productCateLogic;
}

方法四:
该方法有几率导致Spring循环引用问题,所以还是不推荐使用

@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ProductCateController extends BaseController {

    private final ProductCateLogic productCateLogic;

拼写检查

旧版本:
在这里插入图片描述
新版本:
在这里插入图片描述

生成代码

基本使用

  1. 选中要生成的代码,
    在这里插入图片描述

  2. 从菜单中选择Tools | Save as Live Template

  3. 填写触发单词(Abbreviation)
    在这里插入图片描述

  4. 在代码中输入触发单词后按Tab,可以重复生成代码片段

新建类添加注释

/**
 * 
 * @author ${USER}
 * @date ${YEAR}-${MONTH}-${DAY} ${TIME}
 * @version 1.0
 *
 */

在这里插入图片描述

生成 logger

类似

/**
 * logger
 */
private static final Logger LOGGER = LoggerFactory.getLogger(AccessFilter.class);

在这里插入图片描述

然后点击标记2的选项,在弹出的对话框中填入代码组名称
在这里插入图片描述

这里我填入的自定义名称是AI_qnloft,然后选择我们刚刚建立的代码组,点击之前标记3的选项,在代码组中新增自定义代码。
在这里插入图片描述

选择代码语言:
在这里插入图片描述
填入完成后的样子:
在这里插入图片描述
C L A S S CLASS CLASS函数会自动填入当前类名称,但是需要设置一下,点击上图Edit variables按钮
在这里插入图片描述
完成
在这里插入图片描述

常用插件

maven helper
code glance
Alibaba Java Coding Guidelines https://github.com/alibaba/p3c
mybatisx
mybatis log plugin
RestfulToolkit 【全局搜索 Ctrl + \】

无法显示 Run Dashboard 的解决方法

1、进入项目,找到 .idea/workspace.xml 文件
2、找到 <component name="RunDashboard">,增加以下内容

<option name="configurationTypes">
    <set>
        <option value="SpringBootApplicationConfigurationType" />
    </set>
</option>

3、重启

profile

本次运行maven需要哪个profile就选中哪个profile
这里写图片描述
maven 运行配置需要加上 -P参数
这里写图片描述

tomcat + maven profile

配置 maven install

新建一个javaweb项目
目录结构
在这里插入图片描述

pom.xml

    <profiles>
        <profile>
            <id>km-ssm-dev</id>
            <properties>
                <profiles.active>dev</profiles.active>
            </properties>
        </profile>
        <profile>
            <id>km-ssm-test</id>
            <properties>
                <profiles.active>test</profiles.active>
            </properties>
        </profile>
    </profiles>

添加maven启动项
在这里插入图片描述

配置 tomcat

在这里插入图片描述

选择浏览器
点击 fix
在这里插入图片描述

选择 exploded
在这里插入图片描述

回到 server ,选中 update classes and resources
在这里插入图片描述

选择之前的 maven install

在这里插入图片描述

选中profile
在这里插入图片描述

日志位置

catlina.out

C:\Users\Administrator\.IntelliJIdea12\system\tomcat

logback日志位置

安装的tomcat的log目录下

设置单击打开文件或者双击打开文件、自动定位文件所在的位置

在这里插入图片描述

Found duplicated code

File → Settings → Editor → Inspections → General → Duplicated Code.

在这里插入图片描述

快捷编辑

列编辑

Alt + 鼠标

替换空白行

^\s*\n
在这里插入图片描述

10-28 162
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值