简体   繁体   中英

How can I import Spring Framework into Eclipse?

I am having trouble importing spring framework into eclipse. I have downloaded spring but am unable to import it. Can anyone help or direct me to a web page that can do so?

您可以按照本教程进行操作: http : //www.tutorialspoint.com/spring/spring_hello_world_example.htm或使用 spring eclipse 插件(您可以在 eclipse 的 Help/eclipse 市场下找到它并搜索它),或者您可以使用管理您的依赖项的工具,如 maven。

It wouldn't be a bad idea to get familiar with a dependency manager like Maven . For use in Eclipse there is a nice plugin M2Eclipse . The pom.xml file is what you use to specify your dependencies, and then when you build with Maven it resolves everything for you and downloads automatically anything it needs. This is the example pom.xml file from the Maven installation instructions:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Maven Quick Start Archetype</name>
  <url>http://maven.apache.org</url>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

The dependency for the core Spring Framework is

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-core</artifactId>
  <version>4.1.6.RELEASE</version>
</dependency>

And generally you can find the pom.xml dependency specifications at the Maven Repository . Might seem a little overdone for simply getting Spring into Eclipse, but once you have it set up it is then a snap to add more dependencies down the road, all you do is add the appropriate item to the pom.xml file.

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