5

As the topic says I cannot import this package in my web dynamic project using SpringSource Tool Suite.The command Spring Tools --> Add Spring Project Nature has been already executed. Thank you.

4

2 回答 2

3

What kind of project did you create? Is it a Maven project? If so, you need to make sure that you are importing 'at least' the spring-context dependency like so

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>3.1.0.RELEASE</version>
    <scope>runtime</scope>
</dependency>

(or whatever version you want to use)

[EDIT]

Since as you say, you are using a Dynamic Web Project through this example -> http://www.vaannila.com/spring/spring-mvc-tutorial-1.html, you need to physically add the following jar files to your WEB-INF/lib folder

antlr-runtime-3.0
commons-logging-1.0.4
org.springframework.asm-3.0.0.M3
org.springframework.beans-3.0.0.M3
org.springframework.context-3.0.0.M3
org.springframework.context.support-3.0.0.M3
org.springframework.core-3.0.0.M3
org.springframework.expression-3.0.0.M3
org.springframework.web-3.0.0.M3
org.springframework.web.servlet-3.0.0.M3

You should have the following:

lib folder

Adding the 'Spring Project Nature' does not add the dependencies for you, but only instructs the IDE that this project is using Spring.

于 2012-02-05T21:11:10.133 回答
1

Use maven.it automatically adds the necessary jar files.otherwise u need to manually do it.you can have a look at this http://www.mkyong.com/maven/how-to-convert-java-web-project-to-maven-project/ to migrate an existing project into maven

OR

You can manually add the necessary jar files.
Right click on the spring project>>
properties>>
java build path>>
libraries>>Add jars

:)

于 2012-05-05T06:55:47.813 回答