Spring framework
来源:互联网 发布:mac客户端网游 编辑:程序博客网 时间:2024/06/03 12:28
Spring framework
一句话总结:
Core support for dependency injection, transaction management, web applications, data access, messaging, testing and more.
常用术语:
IoC: Inversion of Control。 IoC is also known as dependency injection (DI)
POJOs: Plain Old Java Objects
MVC: model-view-controller
bean: In Spring, the objects that form the backbone of your application and that are managed by the Spring IoC container are called beans
结构:
The Spring Framework consists of features organized into about 20 modules.
These modules are grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, Messaging, and Test.
The Core Container consists of the spring-core, spring-beans, spring-context, spring-context-support, and spring-expression (Spring Expression Language) modules.
The spring-core and spring-beans modules provide the fundamental parts of the framework, including the IoC and Dependency Injection features. The BeanFactory is a sophisticated implementation of the factory pattern. It removes the need for programmatic singletons and allows you to decouple the configuration and specification of dependencies from your actual program logic.
The Context (spring-context) module builds on the solid base provided by the Core and Beans modules: it is a means to access objects in a framework-style manner that is similar to a JNDI registry.
Spring 是怎么样运作的
Your application classes are combined with configuration metadata so that after the ApplicationContext is created and initialized, you have a fully configured and executable system or application.
Dependency management 和 dependency injection 的区别:
Dependency management (例如 Maven 是一种依赖管理工具) and dependency injection are different things. To get those nice features of Spring into your application (like dependency injection) you need to assemble all the libraries needed (jar files) and get them onto your classpath at runtime, and possibly at compile time. These dependencies are not virtual components that are injected, but physical resources in a file system (typically). The process of dependency management involves locating those resources, storing them and adding them to classpaths. Dependencies can be direct (e.g. my application depends on Spring at runtime), or indirect (e.g. my application depends on commons-dbcp which depends on commons-pool). The indirect dependencies are also known as "transitive" and it is those dependencies that are hardest to identify and manage.
ArtifactId和功能的对应关系:
http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/overview.html#dependency-management
configuration metadata
Beans, and the dependencies among them, are reflected in the configuration metadata used by a container.
The interface org.springframework.context.ApplicationContext represents the Spring IoC container and is responsible for instantiating, configuring, and assembling the aforementioned beans.
The container gets its instructions on what objects to instantiate, configure, and assemble by reading configuration metadata.In addition to bean definitions that contain information on how to create a specific bean, the ApplicationContext implementations also permit the registration of existing objects that are created outside the container, by users. This is done by accessing the ApplicationContext’s BeanFactory via the method getBeanFactory() which returns the BeanFactory implementation DefaultListableBeanFactory. DefaultListableBeanFactory supports this registration through the methods registerSingleton(..) and registerBeanDefinition(..).
三种 configuration metadata 方式:
The configuration metadata is represented in XML, Java annotations, or Java code.
XML files are used as input when instantiating a ClassPathXmlApplicationContext。
@Configuration classes is used as input when instantiating an AnnotationConfigApplicationContext。
- Spring framework
- Spring Framework
- Spring Framework
- Spring Framework
- Spring Framework
- Spring Framework
- Spring Framework
- Spring framework
- Spring Framework
- spring framework
- Spring framework
- Spring Framework
- spring-framework
- Spring Framework : What is Spring?
- Introducing to Spring Framework
- Introducing to Spring Framework
- Introducing to Spring Framework
- Introducing the Spring Framework
- excel转PDF怎么样才能保证转换效果好?
- 给自己打打气!
- 中缀表达式转化为后缀表达式,计算中缀表达式,计算后缀表达式(有注释)(逆波兰表达式)
- iOS计算textField的光标偏移量
- Xcode6内置环境变量(Build Setting Macros)
- Spring framework
- C++ 顺序表的基本操作
- iOS动画——Layer Animations
- 关于系统时钟初始化函数“void Stm32_Clock_Init(u8 PLL)
- js时间格式
- js 与或运算符 || && 妙用
- inux下解压命令大全
- cocos2dx使用第三方字库.ttf,需要注意的事项
- new String() 和 String 的区别