Spring link:
Http://s3.amazonaws.com/dist.springframework.org/release/SPR/spring-framework-3.0.5.RELEASE.zip
After the download is complete, decompress the package to the appropriate directory. We recommend that you put the package in the eclipse directory.
There are two import methods. recommended method 1.
Method 1:
Preferences-> JAVA-> build path-> User Libraries
- A new user library named spring
- Add jars to add the jar package that has been decompressed to spring.
- Click OK. OK.
- Left-click Project name-> Properties
Java build path-> Add library-> User library-> next
Select the previously added user library and finish
The spring library is imported successfully.
Method 2:
Directly import the spring library file to the Java build path attribute of the project.
An error is reported when the spring test program is run after the spring library is imported:
Exception in thread "Main" Java. Lang. noclassdeffounderror: ORG/Apache/commons/logging/logfactory At org. springframework. Context. Support. abstractapplicationconteXT. <init> (abstractapplicationconteXT. Java: 160) At org. springframework. Context. Support. abstractrefreshableappliCationcontext. <init> (abstractrefreshableappliCationcontext. Java: 89) At org. springframework. Context. Support. abstractrefreshableconfiGapplicationcontext. <init> (abstractrefreshableconfiGapplicationcontext. Java: 59) At org. springframework. Context. Support. abstractxmlapplicationcoNtext. <init> (abstractxmlapplicationcoNtext. Java: 61) At org. springframework. Context. Support. filesystemxmlapplicationContext. <init> (filesystemxmlapplicationContext. Java: 137) At org. springframework. Context. Support. filesystemxmlapplicationContext. <init> (filesystemxmlapplicationContext. Java: 84) At erictest. erictest. Main (erictest. Java: 8) |
It is found that the Spring-dependent commons-logging library is missing.
Commons-logging Library: http://commons.apache.org/logging/download_logging.cgi
After you import commons-logging in the same way, the program runs correctly.
Scatter flowers!
It is similar when eclipse loads struts2.
Reference http://www.cnblogs.com/ericsun/archive/2011/07/11/2103504.html