当我们刚刚安装完idea时,打开一个mybatis工程的xml映射文件会看到,界面上出现一大堆的黄色背景,特别难看

将光标放在黄色背景处,可以发现出现提示语“No data sources are configured to run this SQL and provide advanced code assistance. Disable this inspection via problem menu”,如下所示

由上面提示信息可以看出,这是因为我们没有配置数据源导致出现的警告,在这里我们可以使用两种方法解决,一种是配置数据源,但是我们一般都很少使用idea去查看数据库,而是使用Navicat等可视化工具去管理;另外一种方法是将数据源警告取消,打开 File =》Setting =》Editor =》Inspections,将“No data sources configured”选项取消选中,然后点击OK保存设置

保存设置之后,我们会发现黄色背景消失了,但是又出现了青色的背景

上面出现的背景是“注入语言”的背景色,可以通过以下步骤去除
File =》Setting =》Editor =》Color Scheme =》General ,选择code下面的“injected language fragment”,将background前面复选框选中取消

点击OK保存设置后发现,青色背景块也消失了

网友评论