Spring 框架概述

Rod Johnson ,  Juergen Hoeller ,  Keith Donald ,  Colin Sampaleanu ,  Rob Harrop ,  Thomas Risberg ,  Alef Arendsen ,  Darren Davison ,  Dmitriy Kopylenko ,  Mark Pollack , Thierry Templier ,  Erwin Vervaet ,  Portia Tung ,  Ben Hale ,  Adrian Colyer ,  John Lewis ,  Costin Leau ,  Mark Fisher ,  Sam Brannen ,  Ramnivas Laddad ,  Arjen Poutsma , Chris Beams ,  Tareq Abedrabbo ,  Andy Clement ,  Dave Syer ,  Oliver Gierke ,  Rossen Stoyanchev ,  Phillip Webb ,  Rob Winch ,  Brian Clozel ,  Stephane Nicoll ,  SebastienDeleuze

4.1.3.RELEASE

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


Table of Contents

I. Spring 框架概述
1. 开启Spring之旅 2. Spring框架概述
2.1. 依赖注入和控制反转 2.2. 模块
2.2.1. 核心容器 2.2.2. AOP和Instrumentation 2.2.3. Messaging 2.2.4. Data Access/Integration 2.2.5. Web 2.2.6. Test
2.3. Usage scenarios
2.3.1. Dependency Management and Naming Conventions
Spring Dependencies and Depending on Spring Maven Dependency Management Maven "Bill Of Materials" Dependency Gradle Dependency Management Ivy Dependency Management Distribution Zip Files
2.3.2. Logging
Not Using Commons Logging Using SLF4J Using Log4J
II. Spring 4.x的新功能
3. Spring 4.0增强和新功能
3.1. 改进的入门体验 3.2. 移除过时的包和方法 3.3. Java 8 (以及6和7) 3.4. Java EE 6和7 3.5. Groovy DSL定义Bean 3.6. 核心容器改进 3.7. 常规Web改进 3.8. WebSocket、SockJS和STOMP消息 3.9. 测试改进
4. Spring 4.1增强和新功能
4.1. JMS改进 4.2. Caching(缓存)改进 4.3. Web改进 4.4. WebSocket STOMP消息改进 4.5. 测试改进
III. 核心技术
5. IoC 容器
5.1. Spring IoC容器和Bean概述 5.2. 容器概述
5.2.1. 配置元数据 5.2.2. 实例化容器
编写基于XML的配置元数据
5.2.3. 使用容器
5.3. Bean概述
5.3.1. bean的命名
bean的别名
5.3.2. 实例化bean
通过构造函数实例化 使用静态工厂方法实例化 使用实例工厂方法实例化
5.4. 依赖
5.4.1. 依赖注入
构造器注入 Setter注入 依赖解决步骤 一些依赖注入的例子
5.4.2. 依赖配置详解
直接变量 (基本类型, String类型等) 引用其他bean(协作者) 内部bean 集合 Null和空字符串 XML使用p命名空间简化 XML shortcut with the c-namespace 组合属性名称
5.4.3. 使用 depends-on 5.4.4. 延迟初始化bean 5.4.5. 自动装配协作者
自动装配的局限性和缺点 将bean排除在自动装配之外
5.4.6. 方法注入
Lookup 方法注入 自定义方法的替代方案
5.5. Bean作用域
5.5.1. 单例作用域 5.5.2. 原型作用域 5.5.3. 依赖原型bean的单例bean 5.5.4. 请求作用域、会话作用域和全局会话作用域
基本的web配置 请求作用域 会话作用域 全局会话作用域 应用程序作用域 将上述作用域的bean作为依赖
5.5.5. Custom scopes
Creating a custom scope Using a custom scope
5.6. 定制bean特性
5.6.1. 生命周期回调
初始化回调函数 析构回调函数 缺省的初始化和析构方法 组合生命周期机制 启动和关闭回调 在非web应用中优雅地关闭Spring IoC容器
5.6.2. ApplicationContextAware and BeanNameAware 5.6.3. 其他 Aware 接口
5.7. Bean定义的继承 5.8. 容器拓展点
5.8.1. 使用BeanPostProcessor自定义beans
Example: Hello World, BeanPostProcessor-style Example: The RequiredAnnotationBeanPostProcessor
5.8.2. Customizing configuration metadata with a BeanFactoryPostProcessor
Example: the Class name substitution PropertyPlaceholderConfigurer Example: the PropertyOverrideConfigurer
5.8.3. Customizing instantiation logic with a FactoryBean
5.9. Annotation-based container configuration
5.9.1. @Required 5.9.2. @Autowired 5.9.3. Fine-tuning annotation-based autowiring with qualifiers 5.9.4. Using generics as autowiring qualifiers 5.9.5. CustomAutowireConfigurer 5.9.6. @Resource 5.9.7. @PostConstruct and @PreDestroy
5.10. Classpath scanning and managed components
5.10.1. @Component and further stereotype annotations 5.10.2. Meta-annotations 5.10.3. Automatically detecting classes and registering bean definitions 5.10.4. Using filters to customize scanning 5.10.5. Defining bean metadata within components 5.10.6. Naming autodetected components 5.10.7. Providing a scope for autodetected components 5.10.8. Providing qualifier metadata with annotations
5.11. Using JSR 330 Standard Annotations
5.11.1. Dependency Injection with @Inject and @Named 5.11.2. @Named: a standard equivalent to the @Component annotation 5.11.3. Limitations of the standard approach
5.12. 基于Java(Java-based)的容器配置
5.12.1. 基本概念: @Bean and @Configuration 5.12.2. Instantiating the Spring container using AnnotationConfigApplicationContext
Simple construction Building the container programmatically using register(Class<?>…) Enabling component scanning with scan(String…) 使用AnnotationConfigWebApplicationContext支持Web应用
5.12.3. 使用@Bean注解
Declaring a bean Receiving lifecycle callbacks Specifying bean scope Customizing bean naming Bean aliasing Bean description
5.12.4. Using the @Configuration annotation
Injecting inter-bean dependencies Lookup method injection Further information about how Java-based configuration works internally
5.12.5. Composing Java-based configurations
Using the @Import annotation Conditionally including @Configuration classes or @Beans Combining Java and XML configuration
5.13. Environment抽象
5.13.1. Bean定义配置文件
@Profile
5.13.2. XML的Bean定义配置文件
启用配置文件 默认配置
5.13.3. PropertySource的抽象 5.13.4. @PropertySource 5.13.5. Placeholder resolution in statements
5.14. 注册一个LoadTimeWeaver 5.15. ApplicationContext 的附加功能
5.15.1. Internationalization using MessageSource 5.15.2. Standard and Custom Events 5.15.3. Convenient access to low-level resources 5.15.4. web 应用程序中 ApplicationContext 的便利实例化 5.15.5. Deploying a Spring ApplicationContext as a Java EE RAR file
5.16. The BeanFactory
5.16.1. BeanFactory or ApplicationContext? 5.16.2. Glue code and the evil singleton
6. Resources
6.1. 介绍 6.2. Resource 接口 6.3. 内置的 Resource 实现
6.3.1. UrlResource 6.3.2. ClassPathResource 6.3.3. FileSystemResource 6.3.4. ServletContextResource 6.3.5. InputStreamResource 6.3.6. ByteArrayResource
6.4. ResourceLoader 接口 6.5. ResourceLoaderAware 接口 6.6. 资源依赖 6.7. 应用上下文和资源路径
6.7.1. 构造应用上下文
构造 ClassPathXmlApplicationContext 实例 - 快捷方式
6.7.2. 使用通配符构造应用上下文
Ant 风格模式 classpath*: 的可移植性 通配符的补充说明
6.7.3. FileSystemResource 警告
7. 数据校验、数据绑定和类型转换
7.1. 概述 7.2. 使用Spring的Validator接口来进行数据校验 7.3. 通过错误编码得到错误信息 7.4. Bean的操作和BeanWrapper
7.4.1. Setting和getting基本及嵌套属性 7.4.2. 内嵌的属性编辑器实现
Registering additional custom PropertyEditors
7.5. Spring Type Conversion
7.5.1. Converter SPI 7.5.2. ConverterFactory 7.5.3. GenericConverter
ConditionalGenericConverter
7.5.4. ConversionService API 7.5.5. Configuring a ConversionService 7.5.6. Using a ConversionService programmatically
7.6. Spring Field Formatting
7.6.1. Formatter SPI 7.6.2. Annotation-driven Formatting
Format Annotation API
7.6.3. FormatterRegistry SPI 7.6.4. FormatterRegistrar SPI 7.6.5. Configuring Formatting in Spring MVC
7.7. Configuring a global date & time format 7.8. Spring Validation
7.8.1. Overview of the JSR-303 Bean Validation API 7.8.2. Configuring a Bean Validation Provider
Injecting a Validator Configuring Custom Constraints Spring-driven Method Validation Additional Configuration Options
7.8.3. Configuring a DataBinder 7.8.4. Spring MVC 3 Validation
Triggering @Controller Input Validation Configuring a Validator for use by Spring MVC Configuring a JSR-303/JSR-349 Validator for use by Spring MVC
8. Spring 表达式语言 (SpEL)
8.1. 介绍 8.2. 功能概述 8.3. 使用Spring的表达接口 表达式求值
8.3.1. EvaluationContext 接口
类型转换
8.3.2. 解析器配置 8.3.3. SpEL 编译
编译器限制
8.4. 定义bean的beandef表达支持
8.4.1. 基于XML的配置 8.4.2. 基于注解的配置
8.5. 语言参考
8.5.1. 文字表达式 8.5.2. Properties, Arrays, Lists, Maps, Indexers 8.5.3. 内联列表 8.5.4. 内联maps 8.5.5. array构造 8.5.6. 方法 8.5.7. 运算符
关系运算符 逻辑运算符 数学运​​算符
8.5.8. 赋值 8.5.9. 类型 8.5.10. 构造 8.5.11. 变量
该#this 和 #root变量
8.5.12. 函数 8.5.13. bean引用 8.5.14. 三元运算符(IF-THEN-ELSE) 8.5.15. Elvis操作符 8.5.16. 安全导航运算符 8.5.17. 集合选择 8.5.18. 集合投影 8.5.19. 表达模板
8.6. Classes used in the examples
9. Aspect Oriented Programming with Spring
9.1. Introduction
9.1.1. AOP concepts 9.1.2. Spring AOP capabilities and goals 9.1.3. AOP Proxies
9.2. @AspectJ 支持
9.2.1. 开启 @AspectJ 支持
开启 @AspectJ 的Java配置方式 开启 @AspectJ 的XML配置方式
9.2.2. 声明一个切面 9.2.3. Declaring a pointcut
Supported Pointcut Designators Combining pointcut expressions Sharing common pointcut definitions Examples Writing good pointcuts
9.2.4. Declaring advice
Before advice After returning advice After throwing advice After (finally) advice Around advice Advice parameters Advice ordering
9.2.5. Introductions 9.2.6. Aspect instantiation models 9.2.7. Example
9.3. Schema-based AOP support
9.3.1. Declaring an aspect 9.3.2. Declaring a pointcut 9.3.3. Declaring advice
Before advice After returning advice After throwing advice After (finally) advice Around advice Advice parameters Advice ordering
9.3.4. Introductions 9.3.5. Aspect instantiation models 9.3.6. Advisors 9.3.7. Example
9.4. Choosing which AOP declaration style to use
9.4.1. Spring AOP or full AspectJ? 9.4.2. @AspectJ or XML for Spring AOP?
9.5. Mixing aspect types 9.6. Proxying mechanisms
9.6.1. Understanding AOP proxies
9.7. Programmatic creation of @AspectJ Proxies 9.8. Using AspectJ with Spring applications
9.8.1. Using AspectJ to dependency inject domain objects with Spring
Unit testing @Configurable objects Working with multiple application contexts
9.8.2. Other Spring aspects for AspectJ 9.8.3. Configuring AspectJ aspects using Spring IoC 9.8.4. Load-time weaving with AspectJ in the Spring Framework
A first example Aspects META-INF/aop.xml Required libraries (JARS) Spring configuration Environment-specific configuration
9.9. Further Resources
10. Spring AOP APIs
10.1. Introduction 10.2. Pointcut API in Spring
10.2.1. Concepts 10.2.2. Operations on pointcuts 10.2.3. AspectJ expression pointcuts 10.2.4. Convenience pointcut implementations
Static pointcuts Dynamic pointcuts
10.2.5. Pointcut superclasses 10.2.6. Custom pointcuts
10.3. Advice API in Spring
10.3.1. Advice lifecycles Advice 生命周期 10.3.2. Advice types in Spring
Interception around advice 拦截 around Advice Before advice Throws advice 抛出Advice After Returning advice 后置advice Introduction advice 介绍的Advice
10.4. Advisor API in Spring 10.5. Using the ProxyFactoryBean to create AOP proxies
10.5.1. Basics 10.5.2. JavaBean properties 10.5.3. JDK- and CGLIB-based proxies 10.5.4. Proxying interfaces 10.5.5. Proxying classes 10.5.6. Using global advisors
10.6. 简洁的代理定义 10.7. 使用编程方式通过ProxyFactory创建AOP代理 10.8. 操作通知对象 10.9. Using the "auto-proxy" facility
10.9.1. Autoproxy bean definitions
BeanNameAutoProxyCreator DefaultAdvisorAutoProxyCreator AbstractAdvisorAutoProxyCreator
10.9.2. Using metadata-driven auto-proxying
10.10. Using TargetSources
10.10.1. Hot swappable target sources 10.10.2. Pooling target sources 10.10.3. Prototype target sources 10.10.4. ThreadLocal target sources
10.11. 定义新的通知类型 10.12. 更多资源 10.13. Spring 测试框架介绍 10.14. 单元测试
10.14.1. 模拟对象
Environment JNDI Servlet API Portlet API
10.14.2. 单元测试支持类
通用组件 Spring MVC
10.15. 集成测试
10.15.1. 概览 10.15.2. 集成测试的目标
上下文管理和缓存 测试夹具的依赖注入 事务管理 集成测试支持类
10.15.3. JDBC 测试支持 10.15.4. 注解
Spring 测试相关注解 标准注解支持 Spring JUnit 测试注解 测试元注解的支持
10.15.5. Spring TestContext Framework
核心概述 TestExecutionListener 配置 上下文管理 Dependency injection of test fixtures Testing request and session scoped beans Transaction management Executing SQL scripts TestContext Framework support classes
10.15.6. Spring MVC Test Framework
Server-Side Tests Client-Side REST Tests
10.15.7. PetClinic Example
10.16. Further Resources
IV. 数据访问
11. 事务管理
11.1. Spring Framework事务管理介绍 11.2. Spring Framework的事务支持模型的优点
11.2.1. 全局事务 11.2.2. 本地事务 11.2.3. Spring Framework的一致性编程模型
11.3. 理解 Spring Framework 的事务抽象 11.4. 在事务中同步资源
11.4.1. 高级同步方法 11.4.2. 低级的同步方法 11.4.3. 事务发现数据源代理(TransactionAwareDataSourceProxy)
11.5. 声明式事务管理
11.5.1. 理解Spring Framework的声明式事务实现 11.5.2. 声明式事务实现的例子 11.5.3. 回滚一个声明式事务 11.5.4. 为不同的bean配置不同的事务 11.5.5. <tx:advice/> 设置 11.5.6. @Transactional 的使用
@Transactional 设置 @Transactional 使用多个事务管理器 自定义快捷注解
11.5.7. 事务传播性
需要 Required 需要新的 RequiresNew 嵌套 Nested
11.5.8. 通知事务操作 11.5.9. 与AspectJ一起使用@Transactional
11.6. 编程式事务管理
11.6.1. 使用TransactionTemplate
指定事务设置
11.6.2. PlatformTransactionManager的使用
11.7. 在编程式和声明式事务管理中选择 11.8. 应用服务器的特异性集成
11.8.1. IBM WebSphere 11.8.2. Oracle WebLogic Server
11.9. 通用问题的解决
11.9.1. 特殊DataSource使用错误的事务管理器
11.10. 更多资源
12. DAO 支持
12.1. 介绍 12.2. 一致的异常层次结构 12.3. 用于配置DAO或库类的注解
13. Data access with JDBC
13.1. Introduction to Spring Framework JDBC
13.1.1. 选择一个访问JDBC数据库的方法
13.2. Using the JDBC core classes to control basic JDBC processing and error handling
13.2.1. JdbcTemplate
Examples of JdbcTemplate class usage JdbcTemplate best practices
13.2.2. NamedParameterJdbcTemplate 13.2.3. SQLExceptionTranslator 13.2.4. Executing statements 13.2.5. Running queries 13.2.6. Updating the database 13.2.7. Retrieving auto-generated keys
13.3. Controlling database connections
13.3.1. DataSource 13.3.2. DataSourceUtils 13.3.3. SmartDataSource 13.3.4. AbstractDataSource 13.3.5. SingleConnectionDataSource 13.3.6. DriverManagerDataSource 13.3.7. TransactionAwareDataSourceProxy 13.3.8. DataSourceTransactionManager 13.3.9. NativeJdbcExtractor
13.4. JDBC batch operations
13.4.1. Basic batch operations with the JdbcTemplate 13.4.2. Batch operations with a List of objects 13.4.3. Batch operations with multiple batches
13.5. Simplifying JDBC operations with the SimpleJdbc classes
13.5.1. Inserting data using SimpleJdbcInsert 13.5.2. Retrieving auto-generated keys using SimpleJdbcInsert 13.5.3. Specifying columns for a SimpleJdbcInsert 13.5.4. Using SqlParameterSource to provide parameter values 13.5.5. Calling a stored procedure with SimpleJdbcCall 13.5.6. Explicitly declaring parameters to use for a SimpleJdbcCall 13.5.7. How to define SqlParameters 13.5.8. Calling a stored function using SimpleJdbcCall 13.5.9. Returning ResultSet/REF Cursor from a SimpleJdbcCall
13.6. 利用java对象操作JDBC
13.6.1. SqlQuery 13.6.2. MappingSqlQuery 13.6.3. SqlUpdate 13.6.4. StoredProcedure
13.7. Common problems with parameter and data value handling
13.7.1. Providing SQL type information for parameters 13.7.2. Handling BLOB and CLOB objects 13.7.3. Passing in lists of values for IN clause 13.7.4. Handling complex types for stored procedure calls
13.8. Embedded database support
13.8.1. Why use an embedded database? 13.8.2. Creating an embedded database instance using Spring XML 13.8.3. Creating an embedded database instance programmatically 13.8.4. Extending the embedded database support 13.8.5. Using HSQL 13.8.6. Using H2 13.8.7. Using Derby 13.8.8. Testing data access logic with an embedded database
13.9. Initializing a DataSource
13.9.1. Initializing a database instance using Spring XML
Initialization of Other Components that Depend on the Database
14. 对象关系映射(ORM)数据访问
14.1. 介绍 Spring 中的 ORM 14.2. 常见的 ORM 集成方面的注意事项
14.2.1. 资源和事务管理 14.2.2. 异常转化
14.3. Hibernate
14.3.1. 在 Spring 容器中设置 SessionFactory 14.3.2. 基于平常的 Hibernate 3 API 来实现 DAO 14.3.3. 声明式事务划分 14.3.4. 编程式事务划分 14.3.5. 事务管理策略 14.3.6. 比较容器管理和本地定义的资源 14.3.7. 在 Hibernate 中的虚假应用服务器告警
14.4. JDO
14.4.1. PersistenceManagerFactory 设置 14.4.2. 基于平常 JDO API 的 DAO 的实现 14.4.3. Transaction management 14.4.4. JdoDialect
14.5. JPA
14.5.1. 三种设置选项
LocalEntityManagerFactoryBean 从 JNDI 中获得 EntityManagerFactory LocalContainerEntityManagerFactoryBean 处理多个持久单元
14.5.2. 基于平常 JPA的 DAO 的实现 14.5.3. 事务管理 14.5.4. JpaDialect
15. Marshalling XML using O/X Mappers
15.1. Introduction
15.1.1. Ease of configuration 15.1.2. Consistent Interfaces 15.1.3. Consistent Exception Hierarchy
15.2. Marshaller and Unmarshaller
15.2.1. Marshaller 15.2.2. Unmarshaller 15.2.3. XmlMappingException
15.3. Using Marshaller and Unmarshaller 15.4. XML Schema-based Configuration 15.5. JAXB
15.5.1. Jaxb2Marshaller
XML Schema-based Configuration
15.6. Castor
15.6.1. CastorMarshaller 15.6.2. Mapping
XML Schema-based Configuration
15.7. XMLBeans
15.7.1. XmlBeansMarshaller
XML Schema-based Configuration
15.8. JiBX
15.8.1. JibxMarshaller
XML Schema-based Configuration
15.9. XStream
15.9.1. XStreamMarshaller
V. The Web
16. Web MVC 框架
16.1. Spring Web MVC 框架介绍
16.1.1. Spring Web MVC 的特点 16.1.2. 其他 MVC 实现的可插入性
16.2. The DispatcherServlet
16.2.1. WebApplicationContext 的专用 bean 16.2.2. 默认的 DispatcherServlet 配置 16.2.3. DispatcherServlet 处理顺序
16.3. Implementing Controllers
16.3.1. 使用 @Controller 定义控制器 16.3.2. 使用 @RequestMapping 映射请求
@Controller' 和 AOP 代理 New Support Classes for @RequestMapping methods in Spring MVC 3.1 URI 模版模式 在 URI 模版上使用正则表达式 路径模式
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值