Spring:浅谈对Spring的认识

官网地址:https://spring.io/projects/spring-framework#overview

压缩包下载地址:https://repo.spring.io/release/org/springframework/spring/

源码地址:https://github.com/spring-projects/spring-framework

Spring makes it easy to create Java enterprise applications. It provides everything you need to embrace the Java language in an enterprise environment, with support for Groovy and Kotlin as alternative languages on the JVM, and with the flexibility to create many kinds of architectures depending on an application's needs. As of Spring Framework 5.1, Spring requires JDK 8+ (Java SE 8+) and provides out-of-the-box support for JDK 11 LTS. Java SE 8 update 60 is suggested as the minimum patch release for Java 8, but it is generally recommended to use a recent patch release.

Spring supports a wide range of application scenarios. In a large enterprise, applications often exist for a long time and have to run on a JDK and application server whose upgrade cycle is beyond developer control. Others may run as a

single jar with the server embedded, possibly in a cloud environment. Yet others may be standalone applications (such as batch or integration workloads) that do not need a server.

Spring is open source. It has a large and active community that provides continuous feedback based on a diverse range of real-world use cases. This has helped Spring to successfully evolve over a very long time.
Spring 使创建 Java 企业应用程序变得更加容易。它提供了在企业环境中接受 Java 语言所需的一切,并支持 Groovy 和 Kotlin 作为 JVM 上的替代语言,并可根据应用程序的需要灵活地创建多种体系结构。从 Spring Framework 5.0 开始,Spring 需要 JDK 8(Java SE 8+),并且已经为 JDK 9 提供了现成的支持。

Spring支持各种应用场景, 在大型企业中, 应用程序通常需要运行很长时间,而且必须运行在 jdk 和应用服务器上,这种场景开发人员无法控制其升级周期。 其他可能作为一个单独的jar嵌入到服务器去运行,也有可能在云环境中。还有一些可能是不需要服务器的独立应用程序(如批处理或集成的工作任务)。

Spring 是开源的。它拥有一个庞大而且活跃的社区,提供不同范围的,真实用户的持续反馈。这也帮助Spring不断地改进,不断发展。

一、Spring的核心

spring是一个开源框架;是为了简化企业开发而生的,使得开发变得更加优雅和简洁;是一个IOC和AOP的容器框架。

1、IOC:控制反转 。

2、AOP:面向切面编程。

3、容器:包含并管理应用对象的生命周期,就好比用桶装水一样,spring就是桶,而对象就是水。

二、使用spring的优势

1、Spring通过依赖注入-DI、面向切面编程-AOP和消除样板式代码来简化企业级Java开发。

2、Spring框架之外还存在一个构建在核心框架之上的庞大生态圈,它将Spring扩展到不同的领域,如Web服务、REST、移动开发以及NoSQL。

3、低侵入式设计,代码的污染极低。

4、独立于各种应用服务器,基于Spring框架的应用,可以真正实现Write Once,Run Anywhere的承诺。

5、Spring的IoC容器降低了业务对象替换的复杂性,提高了组件之间的解耦。

6、Spring的AOP支持允许将一些通用任务如安全、事务、日志等进行集中式处理,从而提供了更好的复用。

7、Spring的ORM和DAO提供了与第三方持久层框架的的良好整合,并简化了底层的数据库访问。

8、Spring的高度开放性,并不强制应用完全依赖于Spring,开发者可自由选用Spring框架的部分或全部。

三、Spring是如何简化开发的

1、基于POJO的轻量级和最小侵入性编程。

2、通过依赖注入和面向接口实现松耦合。

3、基于切面和惯例进行声明式编程。

4、通过切面和模板减少样板式代码。

相关推荐
TT哇6 小时前
【Database Navigator 插件】idea 社区版连接 mysql 数据库
java·数据库·mysql·intellij-idea·database
Tony__Ferguson6 小时前
抽奖系统测试报告
java·功能测试·模块测试
做人不要太理性6 小时前
【Linux系统】ELF 文件格式的硬核揭秘
java·linux·服务器
zhglhy6 小时前
Jaccard相似度算法原理及Java实现
java·开发语言·算法
吃喝不愁霸王餐APP开发者6 小时前
霸王餐API网关层缓存:Nginx Proxy Cache与Cache-Control细节
nginx·spring·缓存
啥都不懂的小小白6 小时前
Java日志篇3:Logback 配置全解析与生产环境最佳实践
java·开发语言·logback
江沉晚呤时6 小时前
延迟加载(Lazy Loading)详解及在 C# 中的应用
java·开发语言·microsoft·c#
谷哥的小弟7 小时前
Spring Framework源码解析——ConfigurableApplicationContext
java·spring·源码
爱学习的小可爱卢7 小时前
JavaEE进阶——MyBatis动态SQL与图书管理系统实战
spring·mybatis
麒qiqi7 小时前
【Linux 系统编程】文件 IO 与 Makefile 核心实战:从系统调用到工程编译
java·前端·spring