I am just learning spring and my first program is to load a bean xml and instantiate the classes.
I will be using spring core and I have created a Java project. Created a package called:
com.lecture
and put the java files there as well as the bean file spring-beans.xml
<beans>
<bean id="rkdf" class="com.college.RKDFCollege"/>
<bean id="cseLect" class="com.college.CSELecturer"/>
</beans>
But when I am running the main class which has this code:
ApplicationContext context = new ClassPathXmlApplicationContext("com.lecture.spring-beans.xml");
it is giving me errors
Dec 07, 2014 9:10:37 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [com.lecture.spring-beans.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com.lecture.spring-beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [com.lecture.spring-beans.xml] cannot be opened because it does not exist
I am new to this I dont have any idea so far! In the project module settings, I have added JDK and Spring jars. Guidance is appreciated.
com.lecture.spring-beans.xml
is not there on the classpath. Do you have s file with that name in your filesystem? – Gábor Bakos