FileNotFoundException while importing a spring xml file

1909 views java
-1

I have the following line in one of my xml file to include the spring.xml file located at src/main/resources/config of my maven project.

<import resource="classpath:config/spring.xml"/> 

I have the location src/main/resources in my build path. Despite this while running it. It is giving the below exception

Caused by: java.io.FileNotFoundException: class path resource [spring.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:329)
... 13 more

Below is the build path source tab

enter image description here

src/main/resources/ :

enter image description here

answered question

1 Answer

10

Try to put / before config. Like this:

classpath:/config/spring.xml

EDIT: Put the Excluded of resources path to (None) and Included: (All)

posted this

Have an answer?

JD

Please login first before posting an answer.