在添加<tx:annotation-driven transaction-manager="txManager"/>程序之前,applicationContext.xml是讀取正常的,其他代碼也是正確運行的。
因為新接觸spring,所以不知道spring的事務管理器也是需要引入包的,引入包以后就解決了問題。
還有可能出錯的地方,在applicationContext.xml加入這句話時,就發生錯誤,這種情況就是
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
有沒有添加的問題了。