一、Eclipse
解決方法:Eclipse中安裝Spring Tools Suite(STS)。
這里采用離線安裝的方式。
1. 官網:https://spring.io/tools3/sts/all
注意:sts的版本需要與你的eclipse對應
查看歷史版本,我的eclipse是4.5.2,所以對應的sts版本是:
#3.7.3.RELEASE是要下載的sts的版本 #e4.5是eclipse的主版本,e4.5.2是eclipse的次版本 #可以在官網中查看sts與eclipse的版本對應關系,然后拼接下載的URL https://download.springsource.com/release/TOOLS/update/3.7.3.RELEASE/e4.5/springsource-tool-suite-3.7.3.RELEASE-e4.5.2-updatesite.zip
2. 安裝
打開eclipse,Help->Install New Software
然后一直Next,完成安裝,重啟eclipse。
3. 查看是否安裝
Window->Show View->Other,查看是否有Spring組件,有則表明我們已經安裝成功了。
4. 用Spring Properties Editor編輯器打開對應文檔,文檔右鍵---> OpenWith -->Spring Properties Editor
二、Intellij IDEA
File->Settings->Editor->File Types 的Registered Patterns里面添加*.properties,讓IDEA把properties文件看做spring文件來處理。