Create a new spring project from Eclipse

Source: Internet
Author: User
Tags apc

One: quasi-work (download the required jar package)

1. Download Preparation spring-framework-4.2.0

Links to:

http://repo.springsource.org/libs-release-local/org/springframework/spring/

  

2. Specific spring-framework4.2.0

  

3. Download Log

Links to:

http://commons.apache.org/proper/commons-logging/download_logging.cgi

  

Two: Construction projects

1. Create a common Java project

  

2. Create a new Lib folder and copy and paste the jar package into

  

3. BUiD the Lib package to path

  

Then import the required jar from the firstspring

Then reply and OK

  

4. The effect at this time

  

5. New Package

Class Package:

  

XML Package

  

6. New Class

First interface

Package Main.java.com.sommer.learn;  Interface HelloWorld {public5}    

Implementation class

Package Main.java.com.sommer.learn;  Implements helloworld{ @Overridepublic String Sayhi () {return ' hahahahahha '; } 9}         

7. Create a new XML file

1 <?xml version= "1.0" encoding= "UTF-8"?>2 <beans3      xmlns= "http://www.springframework.org/ Schema/beans "   4        xmlns:xsi=" Http://www.w3.org/2001/XMLSchema-instance "   6 http://  Www.springframework.org/schema/beans/spring-beans-3.0.xsd ">class=" Main.java.com.sommer.learn.HelloWorldImpl "></bean>         

8. New Main function

1PackageMain.java.com.sommer.learn;2ImportOrg.springframework.context.ApplicationContext;3ImportOrg.springframework.context.support.ClassPathXmlApplicationContext;4 5 public class Main { 6 public static void main (string[] args) { 7 applicationcontext APC = new Classpathxmlapplicationcontext ("Springxml/helloworld.xml"  8 HelloWorld Hello = Apc.getbean ("HelloWorld", Helloworld. 9  System.out.println (Hello.sayhi ()); 10 } 11}      

9. Running

  

Self-written Source: http://pan.baidu.com/s/1kV67rYf

Create a new spring project from Eclipse

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.