Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

eclipse - Why i am not able to run Spring program?

While i am trying to run spring program in eclipse i get following error.

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    BeanFactory cannot be resolved to a type
    XmlBeanFactory cannot be resolved to a type
    FileSystemResource cannot be resolved to a type
    triangle cannot be resolved

    at Org.koushik.javabrains.DrawingApp.main(DrawingApp.java:8)

I tried to resolve this error. I also download spring.jar file and put it in the classpath.But, still i am getting error.I also want whole spring.jar which should include all spring.jar file.

Please help me and thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To manage your dependencies use tools like Maven, Gradle or Ant + Ivy. Those will make your life a whole lot easier, the dependencies will be managed and you will get also all transitive dependencies (the dependencies the framework you use depends on). This will save you a lot of searching around the internet.

With either of these tools you create a build file (ant and maven use XML, Gralde uses Groovy for that) and express your dependencies.

For example this build file for gradle, build.gradle will create a jar and use all the dependencies.

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile group: 'org.springframework', name: 'spring-context', version: '3.2.5.RELEASE'        
    compile group: 'org.springframework', name: 'spring-context-support', version: '3.2.5.RELEASE'        
    testCompile group: 'junit', name: 'junit', version: '4.+'
}

This gradle.build will add the needed spring jars and the dependencies it needs for that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...