alphons
alphons

Reputation: 67

what is the correct file path in eclipse spring

I am working on an introduction to spring course, but I have an issue with my SpringConfig.xml file path. As show on the picture, I just added it everywhere as a hailmary but that's not working either:

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [SpringConfig]; nested exception is java.io.FileNotFoundException: class path resource [SpringConfig] cannot be opened because it does not exist

My path:

enter image description here

Main method code:

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("SpringConfig");
}

Upvotes: 1

Views: 112

Answers (1)

clevertension
clevertension

Reputation: 7077

please don't forget to add the file extension ".xml", spring will read it from src/main/resource

public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("SpringConfig.xml");


}

Upvotes: 1

Related Questions