nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a

來源:互聯網
上載者:User

標籤:公司   and   version   dao   not   oschina   nes   版本   cte   

公司還用的是spring低版本,今天用jre 8測試了一下,發現錯誤:

Unexpected exception parsing XML document from class path resource [applicationContext-dao.xml]; nested exception is java.lang.IllegalStateException: Context namespace element ‘annotation-config‘ and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher,看源碼是org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser自動檢測,jdk版本檢測時需要jre1.5以上版本,但是JdkVersion只檢查到了1.7,jre1.8 時不匹配任何jdk。

網上招到瞭解決的方法,https://my.oschina.net/u/553266/blog/825103

 

網上的解決方案無非兩種:降低jdk的版本或者修改spring-2.5.6.jar的源碼.這些都不是我想要的。我查看了一下在spring-2.5.6jar的org\springframework\core\下有JdkVersion.class這個類,同時在spring-core.4.2.0.RELEASE也有這個類,所以在引入jar包的時候不需要引入spring-2.5.6jar只引入spring-core.4.2.0.RELEASE就行了。問題解決。

nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.