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. CF 9D. How many trees?(dp)

    题目链接 以前做过类似的,USACO,2.3,开始数组开小了,导致数据乱了,然后超数据范围了,.. #include <cstdio> #include <iostream> ...

  2. There was an internal API error.

    1.一开始以为是用了 iOS8的API, 抱着不相信的态度,我搜到了一条原因,可能是没有选择对开发者账号或需要 cmd+shift+k 来 clean 一下,无效. 2.又继续盯着这个问题,才发现我的 ...

  3. [奇葩 bug]视图在 ipad5 上正常显示,在 iPad3上超出了边界

    一,问题分析 1.理论上 iPad 是按像素点排列的,可 iPad5为什么和 iPad3差别那么大??? 2.iPad3超出边界的视图,都有一个 leading 是superview 的 leadin ...

  4. (转)教你实现Winform窗体的四边阴影效果

    1.首先我们得有这样一张阴影图片. 2.然后分别有两个窗体去实现这个阴影效果. SkinForm - 用于实现阴影的绘制,特性:鼠标可穿透,无法点击,跟随窗体. SkinMain - 主窗体,也是承载 ...

  5. 使用ADO.NET访问数据库

    第一种连接数据库的方法:可以使用.ET Framework提供程序的sqlConnection对象,使用无参数的构造函数创建Connection对象,代码如下: string strcon = &qu ...

  6. 伪类link,hover,active,visited,focus的区别

    例一: /*css*/a:link{  color: blue;}a:visited{  color: green;}a:hover{  color: red;}a:focus{ color:blac ...

  7. 树莓派3b+ 用samba与windows共享文件

    1. 树莓派安装samba sudo apt-get install samba 2. 设置一个公共目录 cd /;sudo mkdir share;sudo chmod 777 sharesudo ...

  8. daterangepicker 日期范围插件自定义 可选 年份

    minDate:'01/01/2012',maxDate:'01/01/2015' $("#txtPODate").daterangepicker({ singleDatePick ...

  9. steps animation

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. # 20145334赵文豪 《Java程序设计》第7周学习总结

    20145334赵文豪 <Java程序设计>第7周学习总结 教材学习内容总结 第十三章 时间与日期 13.1.1时间的度量 1.格林威治时间(GMT):参考太阳到达最高点,有时间误差. 2 ...