Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...