I learning Java Spring Framework by listening to the "Spring & Hibernate for Beginners" udemy course. I struggled while trying to import org.springframework.context.support.ClassPathXmlApplicationContext;
Eclipse shows me the error: ClassPathXmlApplicationContext cannot be resolved
The author of the course to which I'm listening is still not involving Maven (and pom.xml) because he is concentrating on "pure" Java and Spring in his course, so please don't direct me to use Maven for organizing the project.
I added all jars from spring-framework-5.0.2.RELEASE-dist to my projects buildpath.
The funny thing is that when i do CTRL+Shift+O Eclipse automatically imports the org.springframework.context.support.ClassPathXmlApplicationContext package, but it shows error in import line (red line under org) and shows an error in my main function on the line where I try to use context as:
ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext("applicationContext.xml");
Please help.
I just want to share that Ш have found a solution to my problem. My execution environment JRE was set to be JAVA SE 10. After I change it to be JAVA SE 1.8 everything started working, and no errors are showing now.
I do it like this:
Delete the module-info.java file in your project, It's only used if you're using Java's built-in module system.
Hope that helps:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With