博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1.Spring官网初探
阅读量:6911 次
发布时间:2019-06-27

本文共 2453 字,大约阅读时间需要 8 分钟。

源码下载地址(
日常生活中,我们发现什么东西都是原装的好,所以无论学习编程语言还是框架,与其花大量的时间搜资料,不如静心好好学习官网,官网是最好的学习资料(权威、准确的第一手材料),spring的官方网址:

官网的界面简洁清新,导航很明确,进入projects

从配置到安全,Web应用到大数据 - 无论您的应用程序有什么样的需求,都有一个Spring Project来帮助您构建它,spring的涵盖面是很宽广的,你需要什么可以在上图所示的页面中查找,本页很清晰,很容易找到spring framework, 还有一段英文介绍provides core support for dependency injection, transaction management, web apps, data access, messaging and more.(提供了核心功能依赖注入、事务管理、web应用、数据访问、远程访问等等)
选择spring framework

本页有介绍、特点说明、spring框架版本对jdk的要求、以及如果使用Maven或 Gradle构建项目的话,官网还提供了相应的范例向导。
最重要是在特征下面的这段话,需要注意:
All avaible features and modules are described in 
. Their 
.
这段话很清晰的告诉我们点击这段话上的链接,专门有关于所有特征和模块以及各模块之间关系的介绍。这是一页有关于spring框架的很详细的介绍,包括spring的Jar包链接以及说明,所以很有必要认真看一看。
Spring框架简介
Spring框架为基于Java的企业应用程序提供了全面的编程和配置模型,Spring的一个关键要素是应用程序级别的基础架构支持:Spring侧重于企业应用程序的“管道”,以便团队可以专注于应用程序级别的业务逻辑,而不必与特定的部署环境形成不必要的联系。
Spring框架特点
  • 依赖注入
  • AOP面向切面的编程,包括Spring的声明式事务管理
  • Spring MVC和Spring WebFlux Web框架
  • 对JDBC,JPA,JMS的基础支持
开始使用
官方推荐在项目中使用spring-framework的方法是使用依赖管理系统 - 下面的代码片段可以复制并粘贴到您的构建中。
maven:
org.springframework
spring-context
5.0.2.RELEASE
gradle:
dependencies {    compile 'org.springframework:spring-context:5.0.2.RELEASE'}
Spring框架包含许多不同的模块。这里我们展示了提供核心功能的spring-context模块
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;@Componentpublic 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@ComponentScanpublic 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();  }}
你可能感兴趣的文章
LINQ扩展实现去重复
查看>>
Linq to entity优化---MSDN
查看>>
多种方式实现依赖注入
查看>>
20150625_Andriod_01_ListView1_条目显示
查看>>
jmeter线程组之间传递参数
查看>>
2016 11 24
查看>>
monkey测试===Monkey测试策略(系列二)转
查看>>
安全测试===如何查看浏览器保存的密码
查看>>
java中too many characters in character literal
查看>>
POJ3177 Redundant Paths【双连通分量】
查看>>
bzoj3339 bzoj3585
查看>>
bzoj4080
查看>>
El表达式的用法个人总结
查看>>
object - c 语言基础 进阶笔记 随笔笔记
查看>>
iOS开发之--一些有用的博文和博客
查看>>
jmeter JDBC Request (查询数据库获取数据库数据) 的使用
查看>>
深入理解ajax系列第七篇——传递JSON
查看>>
Vim简明学习
查看>>
poj4012
查看>>
16.文件file
查看>>