Spring Source Research--download-compile-import eclipse-verification

Source: Internet
Author: User

One, environment configuration

Operating system: Unbutu14.04lts

Jdk:1.8.0_40

git:1.9.1

gradle:2.2.1

Second, source code download-compile-import eclipse-verification

1, download

Use git direct clone spring source to Local: Git clone git://github.com/springsource/spring-framework.git

2, compiling

Compile process, here so-called compile is through the Gradle tool compiled Spring-framework project files, the main thing is to download spring each module depends on the jar package, this process is generally very slow, probably because the resources are outside the wall, And may be a long time to download the jar package, when the direct CTRL + C exit the compile command and execute the command again, for the download has been downloaded since the package will not be downloaded again, so the compilation process is quite with the effect can be disconnected.

① into the source directory execution: Gradle eclipse-x: Eclipse (I spent 1 mornings compiling the pass)

②, perform gradle install this specific god horse effect I'm not sure, but do not execute this command import ① compiled code after eclipse there will be a bunch of build path error, The conjecture should be to put down the dependency in step 1 into the Gradle local repository to make the project lookup use dependent dependencies.

③, directly through the import of eclipse into the Spring-framework source directory

Groovy This project may have methods not found, the main reason when your eclipse did not install groovy plug-ins, installed after clean under the project is OK

④, verifying

Write a simple test project, simple IOC invoke function, dependent Spring-context project

a), Testspring.java
1 ImportOrg.springframework.context.ApplicationContext;2 ImportOrg.springframework.context.support.ClassPathXmlApplicationContext;3 4 ImportCom.test.bean.Lover;5 6 7  Public classtestspring {8     /**9      * @paramargsTen      */ One@SuppressWarnings ("Resource") A      Public Static voidMain (string[] args) { -ApplicationContext CTX =NewClasspathxmlapplicationcontext ("Bean.xml"); -Lover p = Ctx.getbean ("Lover", Lover.class); the p.info (); -     } -  -}

b), Lover.java

1  PackageCom.test.bean;2 3  Public classLover {4     5     PrivateString name;6     Private intAge ;7     8      PublicString GetName () {9         returnname;Ten     } One      Public voidsetName (String name) { A          This. Name =name; -     } -      Public intGetage () { the         returnAge ; -     } -      Public voidSetage (intAge ) { -          This. Age =Age ; +     } -      Public voidinfo () { +System.out.println ("Spring is a best lover fro you~~~"); A     } at}

c), Bean.xml

1<?xml version= "1.0" encoding= "UTF-8"?>2<Beans3Xmlns= "Http://www.springframework.org/schema/beans"4Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"5xmlns:context= "Http://www.springframework.org/schema/context"6Xsi:schemalocation= "Http://www.springframework.org/schema/beans7http//www.springframework.org/schema/beans/spring-beans-2.5.xsd8http//Www.springframework.org/schema/context9http//www.springframework.org/schema/context/spring-context-2.5.xsdTen"> One                      A<bean id= "Lover"class= "Com.test.bean.Lover" scope= "prototype" ></bean> -  -</beans>

Three, summary

This article mainly summarizes the spring source download (GitHub), the compilation (Gradle), the process of importing eclipse, and finally the function of the SPRINGIOC module after importing eclipse is simply tested. Since then, the spring source of deep research into the road.

This article All rights reserved, reprint please indicate the source

Spring Source Research--download-compile-import eclipse-verification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.