Spring实战第一章
2018-03-22 08:58
141 查看
Spring之旅
1.1 简化Java开发
为了降低Java开发的复杂性,Spring采取了以下4中策略:+ 基于POJO的轻量级和最小侵入性编程
+ 通过依赖注入和面向接口实现松耦合
+ 基于切面和惯例进行声明式编程
+ 通过切面和模板减少样板式代码
1.2 容纳你的bean
Spring并不是只有一个。Spring自带多个容器实现,可以归为两种不同类型:+ bean工厂
+ 应用上下文(由org.springframework.context.ApplicationContext接口定义),基于BeanFactory创建
1.2.1 使用应用上下文
AnnotationConfigApplicationContext从一个或多个基于java的配置类中加载Spring应用上下文AnnotationConfigWebApplicationContext从一个或多个基于java的配置类中加载Spring Web应用上下文
ClassPathXmlApplicationContext从类路径下的一个或多个XML配置文件中加载上下文定义,把应用上下文的定义文件作为类资源
FileSystemXmlapplicationContext从文件系统下的一个或多个XML配置文件中加载上下文定义
XmlWebApplicationContext从Web应用下的一个或多个XML配置文件中加载上下文定义
ApplicationContext context = new AnnotationConfigApplicationContext(com.springinaction.knights.config.KnightConfig.class);
ApplicationContext context = new FileSystemXmlapplicationContext("c:/knight.xml");
ApplicationContext context = new ClassPathXmlApplicationContext("knight.xml");
另外两种的详细讨论请见第8章
1.2.2 bean的生命周期
Spring对bean进行实例化Spring将值和bean的引用注入到bean对应的属性中
如果bean实现了BeanNameAware接口,Spring将bean的ID传递给setBeanName()方法
如果bean实现了BeanFactoryAware接口,Spring将调用setBeanFactory()方法,将BeanFactory容器实例传入
。。。
俯瞰Spring风景线
Spring模块
Spring核心容器Spring的AOP模块
数据访问与集成
Web与远程调用
Instrumentation
测试
Spring Portfolio
Spring Web FlowSpring Web Service
Spring Security
Spring Integration
相关文章推荐
- Spring3开发实战 之 第一章:Spring入门
- Spring In Action 4(Spring实战第四版)翻译与理解 第一章 付诸行动
- Spring 实战-第一章-基本概念
- spring实战笔记_第一章
- 《Spring 实战第一章学习笔记》
- Spring3开发实战 之 第一章:Spring入门
- SpringBoot学习-第一章 新的Spring基础-<Spring Boot 实战>
- spring实战第三版自学---第一章
- Spring实战(第4版) Spring Inaction 笔记(第一章)依赖注入和AOP
- Spring3开发实战 之 第一章:Spring入门
- spring in action (spring 实战)笔记 第一章
- Spring3开发实战 之 第一章:Spring入门
- Spring实战 第一章 1.4 Spring 中的新内容
- Spring任务调度实战之Quartz Cron Trigger
- Spring Data JPA实战视频教程
- SpringBoot | 第一章:第一个SpringBoot应用
- Spring实战——缓存
- spring4学习记录04-spring mvc实战之框架构建引入jpa
- Spring实战3-最小化Spring XML配置
- SpringBoot实战(二)之计划任务