简体   繁体   中英

Spring Classes not found in eclipse

I am new to spring and i am trying to build a spring application using SpringSource Tool Suite. I installed STS from the .sh file available. I tried to do the following :

ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");

But eclipse is not able to find these classes. How do I add this class to eclipse. If I need to import certain JAR's where do i find them?

They need to be in the CLASSPATH . That's where Spring looks for .xml context files when you use the ClassPathXmlApplicationContext class.

Put JARs, including Spring, in the WEB-INF/lib directory. If you put your .xml files in the WEB-INF/classes folder they'll be in the CLASSPATH by default.

here you go: http://www.springsource.org/download . First shot at google ( spring download ).

Start with a Spring Template project.

New Project/SpringSource Tool Suite/Spring Template Project/

then select one, for example "spring MVC Project".

This projects are maven based, so they will download the needed/specified jars automaticaly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM