1. 程式人生 > >去掉IntelliJ IDEA 中mapper xml 檔案警告

去掉IntelliJ IDEA 中mapper xml 檔案警告

版權宣告:本文為博主原創文章,如需轉載,請寫明出處, 尊重他人即尊重自己(^_^)。 
http://blog.csdn.net/aubdiy/article/details/68485336

IntelliJ IDEA 開啟 mybatis 的 xml 檔案時,對應的 xml 檔案中 sql 語句背景色總是有黃色或綠色的背景色。

這裡寫圖片描述

提示(紅圈處)上已經說明,需要配置在 IDEA 中配置 data source (通常我們很少使用 IDE 去檢視資料庫內容,而是使用其他專門的 DB 工具)。


去掉 No data sources configure 警告

當然,如果你選擇配置 data source

 也可以,純屬個人習慣)

  • Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ No data sources configure。
  • 取消勾選,去掉這個檢查,然後點選 OK 按鈕即可。

這裡寫圖片描述

此時仍有警告,不過警告資訊變了,如圖中紅圈所示

這裡寫圖片描述


去掉 SQL dialect is not configured 警告

  • Prefernces ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ SQL dialect detection。
  • 取消勾選,去掉這個檢查,然後點選 OK 按鈕即可。

這裡寫圖片描述

此時仍有綠色的背景色

這裡寫圖片描述


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

  • Prefernces ⇒ Editor ⇒ Colors & Fonts ⇒ General ⇒ Code ⇒ Injected language fragment ⇒ Background。
  • 取消勾選,然後點選 OK 按鈕即可。

這裡寫圖片描述


世界清淨了!!! 
世界清淨了!!! 
世界清淨了!!!