環境:Eclipse+Spring

改成aspectJ的優點是不用再去更換伺服器(Tomcat)的檔案,變成可以全部在Eclipse裡完成
(另外還可以刪除兩項loadtime-weaver的文字設定)

1. 到主機裡裝Tomcat的資料夾裡把loadtime-weaver jar檔刪除

2. 在applicationContext.xml 把整個 <loadtime-weaver> 的tag內容刪除

3. 刪除專案裡 META-INF/context.xml

4. Eclipse對專案按右鍵 configure-> convert to aspectJ
 右鍵property打開選項設定→選擇「aspectJ build」→切換到「 aspectJ path」分頁
 →點選「Add External Jars...」按鈕→到maven資料夾選對應版本的spring-aspects-xxx.jar
 (例如 C:\Users\使用者名稱\.m2\repository\org\springframework\spring-aspects\4.3.1.RELEASE\spring-aspects-4.3.1.RELEASE.jar)

undefined

------------------------

換成aspectJ以後只有一個地方要改,當更新Spring版本的時候重新執行步驟4,
把spring-aspect換成和現在pom.xml裡設定的一樣版本

相关文章