Introduction

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

Features

  • Dependency Injection
  • Aspect-Oriented Programming including Spring's declarative transaction management
  • Spring MVC web application and RESTful web service framework
  • Foundational support for JDBC, JPA, JMS
  • Much more…

All avaible features and modules are described in the Modules section of the reference documentation. Their maven/gradle coordinates are also described there.

Minimum requirements

  • JDK 6+ for Spring Framework 4.x
  • JDK 5+ for Spring Framework 3.x

Quick Start

Download
                          
                 ()             
                          
                 ()             
                          
                 ()             
                          
                 ()             
                          
                 ()             
                          
                 ()

 
4.3.2

 
 
 
MAVEN
GRADLE

The recommended way to get started using spring-framework in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
</dependencies>

Spring Framework includes a number of different modules. Here we are showingspring-context which provides core functionality. Refer to the getting started guides on the right for other options.

Once you've set up your build with the spring-context dependency, you'll be able to do the following:

hello/MessageService.java

package hello;

public interface MessageService {
String getMessage();
}

hello/MessagePrinter.java

package hello;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; @Component
public class MessagePrinter { final private MessageService service; @Autowired
public MessagePrinter(MessageService service) {
this.service = service;
} public void printMessage() {
System.out.println(this.service.getMessage());
}
}

hello/Application.java

package hello;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.*; @Configuration
@ComponentScan
public class Application { @Bean
MessageService mockMessageService() {
return new MessageService() {
public String getMessage() {
return "Hello World!";
}
};
} public static void main(String[] args) {
ApplicationContext context =
new AnnotationConfigApplicationContext(Application.class);
MessagePrinter printer = context.getBean(MessagePrinter.class);
printer.printMessage();
}
}

The example above shows the basic concept of dependency injection, the MessagePrinter is decoupled from the MessageService implementation, with Spring Framework wiring everything together.

from: http://projects.spring.io/spring-framework/#quick-start

Spring框架简介 Spring Framework Introduction的更多相关文章

  1. Spring 系列: Spring 框架简介 -7个部分

    Spring 系列: Spring 框架简介 Spring AOP 和 IOC 容器入门 在这由三部分组成的介绍 Spring 框架的系列文章的第一期中,将开始学习如何用 Spring 技术构建轻量级 ...

  2. Spring 系列: Spring 框架简介(转载)

    Spring 系列: Spring 框架简介 http://www.ibm.com/developerworks/cn/java/wa-spring1/ Spring AOP 和 IOC 容器入门 在 ...

  3. 1. Spring 框架简介及官方压缩包目录

    一.Spring 框架简介及官方压缩包目录介绍 1.主要发明者:Rod Johnson 2.轮子理论推崇者:     2.1 轮子理论:不用重复发明轮子.     2.2 IT 行业:直接使用写好的代 ...

  4. Spring4- 01 - Spring框架简介及官方压缩包目录介绍- Spring IoC 的概念 - Spring hello world环境搭建

    一. Spring 框架简介及官方压缩包目录介绍 主要发明者:Rod Johnson 轮子理论推崇者: 2.1 轮子理论:不用重复发明轮子. 2.2 IT 行业:直接使用写好的代码. Spring 框 ...

  5. Spring 框架简介

    Spring 是一个开源框架,是为了解决企业应用程序开发复杂性而创建的.框架的主要优势之一就是其分层架构,分层架构允许您选择使用哪一个组件,同时为 J2EE 应用程序开发提供集成的框架. 在这篇由三部 ...

  6. [JavaEE] IBM - Spring 系列: Spring 框架简介

    Spring AOP 和 IOC 容器入门 在这由三部分组成的介绍 Spring 框架的系列文章的第一期中,将开始学习如何用 Spring 技术构建轻量级的.强壮的 J2EE 应用程序.develop ...

  7. Spring笔记——Spring框架简介和初次框架配置

    Spring简介 Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson 在其著作Expert One-On-One J2EE Deve ...

  8. Spring 系列: Spring 框架简介

    Spring AOP 和 IOC 容器入门(转载) 在这由三部分组成的介绍 Spring 框架的系列文章的第一期中,将开始学习如何用 Spring 技术构建轻量级的.强壮的 J2EE 应用程序.dev ...

  9. SHH入门:Spring框架简介

    (1)Spring 七大模块 核心容器:核心容器提供Spring 框架的基本功能.核心容器的主要组件是 BeanFactory,它是工厂模式的实现.BeanFactory 使用控制反转 (IOC) 模 ...

随机推荐

  1. windows下cmd时复制dos中的内容 错误信息等

    16:28 2015/11/23小发现 windows下cmd时复制dos中的内容,错误信息等:鼠标右键选择标记,然后ctrl c 即可.

  2. 【POJ】3648 Wedding

    http://poj.org/problem?id=3648 题意:n对人(编号0-n-1,'w'表示第一个人,'h'表示第二个人),每对两个,人坐在桌子两侧.满足:1.每对人中的两个人不能坐在同一侧 ...

  3. Codeforces Round #203 (Div. 2)

    非常幸运..第三题,有个地方没想清楚,枚举一下就行了..x to n,这个x没考虑好,跪了...傻傻的lock了代码,通过hack进了DIV1,5-2 . 第一次进入DIV1,记录一下. 不知不觉,已 ...

  4. osg中遇到的问题

    osg中遇到的问题 今天写程序的时候, 需要把键盘和鼠标消息转发出来, 就直接写了接口用signal丢出来了. 程序写的很多, 测试的时候却崩溃了.... 在场景中拖拽鼠标左键的时候, 会发现在扔出鼠 ...

  5. ArcGIS几种数据格式

    ArcGIS几种数据格式 ArcInfo常用以下格式的数据:shp.Coverage..Raster CAD和Geodatabase.各种数据的组织形式不一样,其中shp.Coverage.Raste ...

  6. The Bus Driver Problem

    题目连接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=90648#problem/G 题意: 给每位司机分配一个白天和晚上的行车路线, ...

  7. 11877 The Coco-Cola Store

    题目:    11877  The Coco-Cola Store Once upon a time, there is a special coco-cola store. If you retur ...

  8. CSS的class、id、css文件名的常用命名规则

    CSS的class.id.css文件名的常用命名规则        (一)常用的CSS命名规则 头:header       内容:content/container       尾:footer   ...

  9. 《深入.NET平台和C# 编程》内测纠错记录

    1.  .NET框架的核心组件包括(BD)(选择两项) A.CTS   (通用类型系统) B.CLR   (公共语言运行时,.NET的基础) C.CLS   (公共语言规范) D.FCL   (框架类 ...

  10. Jquery dialog属性

    修改标题: $('#test').dialog("option","title", "测试").dialog('open'); 修改位置: ...