IntelliJ IDEA 打开 mybatis 的 xml 文件时,对应的 xml 文件中 sql 语句背景色总是有黄色或绿色的背景色。

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告

提示(红圈处)上已经说明,需要配置在 IDEA 中配置 data source (通常我们很少使用 IDE 去查看数据库内容,而是使用其他专门的 DB 工具)。


去掉 No data sources configure 警告

当然,如果你选择配置 data source 也可以,纯属个人习惯)

  • Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ No data sources configure。
  • 取消勾选,去掉这个检查,然后点击 OK 按钮即可。

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告

此时仍有警告,不过警告信息变了,如图中红圈所示

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告


去掉 SQL dialect is not configured 警告

  • Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ SQL dialect detection。
  • 取消勾选,去掉这个检查,然后点击 OK 按钮即可。

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告

此时仍有绿色的背景色

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告


去掉“注入语言”的背景色

  • Prefernces ⇒ Editor ⇒ Colors & Fonts ⇒ General ⇒ Code ⇒ Injected language fragment ⇒ Background。
  • 取消勾选,然后点击 OK 按钮即可。

去掉IntelliJ IDEA 中 mybatis 对应的 xml 文件警告


世界清净了!!! 世界清净了!!! 世界清净了!!!

转载于:https://my.oschina.net/aub/blog/870625

相关文章:

  • 2021-09-24
  • 2022-01-16
  • 2022-12-23
  • 2021-04-02
  • 2021-07-09
  • 2022-01-02
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2021-06-06
相关资源
相似解决方案