我的xml文件到Java配置我無法加載此,在豆類的Java類文件如何在java中無錯誤地將xml加載到ClassPathXmlApplicationContext?
main.java:
ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
PDF2HTMLService service = appContext.getBean(PDF2HTMLService.class);
錯誤:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: org.springframework.context.support.ClassPathXmlApplicationContext cannot be converted to org.springframework.context.ApplicationContext
at pdf2html.Main.main(Main.java:27)
Java Result: 1
我怎樣才能解決這個問題問題...
XML FILE:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<aop:aspectj-autoproxy />
<context:component-scan base-package="pdf2html" />
</beans>
你使用的是什麼彈簧依賴關係? – geoand
也請在代碼 – geoand
中顯示您的進口產品您使用的彈簧瓶的版本是什麼? – Sanjeev