A brief introduction to Spring4-1-spring

Source: Internet
Author: User

Spring4.0 is a major version of Spring's upgrade that further strengthens Sring's position as the first open source platform in the Java world. Spring4.0 introduces new features that many Java developers expect, such as generic dependency injection, SPEL, checksum format framework, RESTful WEB programming model, and more. These new features are practical and easy to use, greatly reducing the difficulty of Java EE development, while effectively improving the elegance of application development.

Let's start with the understanding of spring: Spring is an open source framework, and it's designed to simplify enterprise-class application development. Using Spring enables simple JavaBean to implement functionality that was previously only available to EJBS; Spring is an IOC (DI) and an AOP container framework.
   Lightweight : Spring is non-invasive-objects in spring-based applications can be independent of spring's API
   Dependency Injection (DI---Dependency injection, IOC)
   plane-oriented programming (AOP---aspect oriented programming)
   container : Spring is a container because it contains and manages the life cycle of the Application object
   Framework : Spring implements a complex application that is combined with a simple component configuration. These objects can be combined in Spring using XML and Java annotations
   One-stop : Integration of open source frameworks and excellent third-party libraries for enterprise applications based on IOC and AOP (in fact, spring itself provides the SPRINGMVC and persistence layer of spring JDBC for the presentation layer)

Spring's modular structure:

Simply create a spring project:

1. I am using the Spring tool suite,eclipse, an integrated spring IDE.

2. Create a MAVEN project that introduces Spring's jar package.

    

3. Create an App context profile-applicationcontext.xml.

    

4. Create a Bean object-hello.java

 Packagespring.demo_01; Public classHello {PrivateString name;  PublicString GetName () {returnname; }     Public voidsetName (String name) { This. Name =name; }     Public voidHello () {System.out.println ("Hello" +name); }}

5. Configure the Bean object in Applicationcontext.xml:

  

6. Load the configuration file and create an instance of the Bean object-hello.

  

  Note: In step 1, when you create a container object, the instance object in the configuration file has been created automatically, and the corresponding property values have been injected.

In this way, one of the simplest spring projects is created.

A brief introduction to Spring4-1-spring

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.