Hi,
My question is similar to
https://coderanch.com/t/424153/Spring/Application-Frameworks/beans-xml-cannot-opened-because
I kinda know the answer in one way but still could not figure out the way I expect
I have folder structure as follows.
project->src->
java
com.x.y.Hello.java
project->src->conf
beans.xml
Code looks like,
Exception:
Exception in
thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [conf/beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [conf/beans.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
So I have tried few other combinations:
but nothing works.
So I have changed the folder structure to
project->src->
com.x.y.Hello.java
project->src->
beans.xml
ofcourse everything works!
But I do not want to compromise the folder structure.
1) So how to add conf/beans.xml into the classpath so that ClassPathXmlApplicationContext can resolve it.
2) Also how do I find out list of class paths loaded by ClassPathXmlApplicationContext?
I use spring 2.5.x and I thought I will use like,
Now I run into
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'hello' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
3) If I see the above error that means the beans.xml is found but not the bean 'hello' correct? If so, how to resolve this?
Any help is appreciated. Thanks.