使用MyEclipse開發java,我比較喜歡用MyEclispe XML Editor編輯xml檔案。曾經用過XmlBuddy(大概是這麼個名字吧),感覺他像吹牛~ ~字型很小,提示功能也不十分突出,比MyEclispe XML Editor強的地方是可以自動縮進。是以還是用MyEclispe XML Editor吧。
利用MyEclipse添加Spring2.5的支援庫開發AOP的話,雖然引入了AOP的支援包,但是配置檔案卻不支援AOP配置。Eclipse自動生成的ApplicationContext.xml檔案命名空間如下:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
</beans>
。
為了支援AOP,需要加入spring-aop-2.5.xsd。給檔案位于%SPRING_HOME%\dist\resources目錄中。這個目錄有很多資源檔案,根據不同的需要選擇添加,我們隻需要spring-aop-2.5.xsd。修改後的頭部變成了這樣:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
</beans>
這樣Eclipse就支援AOP配置了。配合代碼提示鍵就可以友善開發了。