没有合适的资源?快使用搜索试试~ 我知道了~
首页spring-framework-reference 3.0
Spring 3.0是Spring框架的一次重大更新,而根据SpringSource副总裁Shaun Connolly的描述,Spring框架是当下最流行的Java开发框架。 全新的Spring 3.0提供了全面的RESTful Web服务支持,以及一个新的表达式语言。其tc服务器此次也提供了全新的开发者版本,可以免费供开发者下载,用于调试其Spring应用。 Spring 3.0中,新的表达式语言名叫Spring Expression Language(SpEL,直译就是Spring表达式语言)。Shaun将其描述为“嵌入在Spring编程模型上的,可以用来在Spring项目之间描述任务以及配置的微型脚本语言。SpEL可以更好的与XML配置文件进行交互,对于安全和集成方面也很有帮助。开发者的工作将更加轻松:原本需要20行Java代码的工作,通过一行SpEL便能解决。” Spring 3.0最新的API与大家分享 希望能给大家带来很大的帮助哦。
资源详情
资源评论
资源推荐
Reference Documentation
3.1
Copyright © 2004-2011 Rod Johnson, Juergen Hoeller, Keith Donald, Colin Sampaleanu, Rob
Harrop, Alef Arendsen, Thomas Risberg, 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
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. Overview of Spring Framework ..............................................................................................1
1. Introduction to Spring Framework ..................................................................................2
1.1. Dependency Injection and Inversion of Control ....................................................2
1.2. Modules ............................................................................................................3
Core Container .................................................................................................3
Data Access/Integration ....................................................................................3
Web .................................................................................................................4
AOP and Instrumentation ..................................................................................4
Test .................................................................................................................4
1.3. Usage scenarios .................................................................................................5
Dependency Management and Naming Conventions ...........................................6
Spring Dependencies and Depending on Spring ..........................................8
Maven Dependency Management ..............................................................8
Ivy Dependency Management .................................................................10
Logging .........................................................................................................10
Not Using Commons Logging .................................................................11
Using SLF4J ..........................................................................................11
Using Log4J ...........................................................................................13
II. What's New in Spring 3 ......................................................................................................15
2. New Features and Enhancements in Spring 3.0 .............................................................16
2.1. Java 5 ..............................................................................................................16
2.2. Improved documentation ..................................................................................16
2.3. New articles and tutorials ..................................................................................16
2.4. New module organization and build system .......................................................17
2.5. Overview of new features .................................................................................18
Core APIs updated for Java 5 ..........................................................................19
Spring Expression Language ...........................................................................19
The Inversion of Control (IoC) container ..........................................................20
Java based bean metadata ........................................................................20
Defining bean metadata within components ..............................................21
General purpose type conversion system and field formatting system .................21
The Data Tier .................................................................................................21
The Web Tier .................................................................................................22
Comprehensive REST support .................................................................22
@MVC additions ...................................................................................22
Declarative model validation ...........................................................................22
Early support for Java EE 6 .............................................................................22
Support for embedded databases ......................................................................22
3. New Features and Enhancements in Spring 3.1 .............................................................23
3.1. Overview of new features .................................................................................23
Spring Framework
3.1 Reference Documentation ii
Cache Abstraction ..........................................................................................23
Bean Definition Profiles ..................................................................................23
Environment Abstraction ................................................................................23
PropertySource Abstraction .............................................................................23
Code equivalents for Spring's XML namespaces ...............................................24
Builder-style APIs for code-based Hibernate configuration ................................24
TestContext framework support for @Configuration classes and bean definition
profiles ..........................................................................................................24
c: namespace for more concise constructor injection .........................................24
Support for injection against non-standard JavaBeans setters .............................24
Support for Servlet 3 code-based configuration of Servlet Container ..................25
Support for Servlet 3 MultipartResolver ...........................................................25
JPA EntityManagerFactory bootstrapping without persistence.xml ....................25
New HandlerMethod-based Support Classes For Annotated Controller Processing
.......................................................................................................................25
Consumes and Produces @RequestMapping Conditions ...................................26
Working With URI Template Variables In Controller Methods ..........................26
Validation For @RequestBody Method Arguments ...........................................27
III. Core Technologies ............................................................................................................28
4. The IoC container .......................................................................................................29
4.1. Introduction to the Spring IoC container and beans .............................................29
4.2. Container overview ..........................................................................................29
Configuration metadata ...................................................................................30
Instantiating a container ..................................................................................31
Composing XML-based configuration metadata .......................................33
Using the container .........................................................................................33
4.3. Bean overview .................................................................................................34
Naming beans .................................................................................................35
Aliasing a bean outside the bean definition ...............................................36
Instantiating beans ..........................................................................................37
Instantiation with a constructor ................................................................37
Instantiation with a static factory method .................................................38
Instantiation using an instance factory method ..........................................38
4.4. Dependencies ...................................................................................................40
Dependency injection ......................................................................................40
Constructor-based dependency injection ...................................................40
Setter-based dependency injection ...........................................................42
Dependency resolution process ................................................................43
Examples of dependency injection ...........................................................45
Dependencies and configuration in detail .........................................................47
Straight values (primitives, Strings, and so on) .........................................47
References to other beans (collaborators) .................................................48
Inner beans .............................................................................................49
Collections .............................................................................................50
Null and empty string values ...................................................................52
Spring Framework
3.1 Reference Documentation iii
XML shortcut with the p-namespace ........................................................53
XML shortcut with the c-namespace ........................................................54
Compound property names ......................................................................55
Using depends-on ...........................................................................................55
Lazy-initialized beans .....................................................................................56
Autowiring collaborators .................................................................................56
Limitations and disadvantages of autowiring ............................................58
Excluding a bean from autowiring ...........................................................58
Method injection ............................................................................................59
Lookup method injection .........................................................................60
Arbitrary method replacement .................................................................61
4.5. Bean scopes .....................................................................................................62
The singleton scope ........................................................................................63
The prototype scope ........................................................................................64
Singleton beans with prototype-bean dependencies ...........................................65
Request, session, and global session scopes ......................................................65
Initial web configuration .........................................................................65
Request scope .........................................................................................66
Session scope .........................................................................................66
Global session scope ...............................................................................67
Scoped beans as dependencies .................................................................67
Custom scopes ...............................................................................................69
Creating a custom scope ..........................................................................69
Using a custom scope ..............................................................................70
4.6. Customizing the nature of a bean .......................................................................71
Lifecycle callbacks .........................................................................................72
Initialization callbacks ............................................................................72
Destruction callbacks ..............................................................................73
Default initialization and destroy methods ................................................73
Combining lifecycle mechanisms ............................................................75
Startup and shutdown callbacks ...............................................................75
Shutting down the Spring IoC container gracefully in non-web applications 77
ApplicationContextAware and BeanNameAware ..............................................78
Other Aware interfaces ...................................................................................78
4.7. Bean definition inheritance ...............................................................................80
4.8. Container Extension Points ...............................................................................82
Customizing beans using a BeanPostProcessor .................................................82
Example: Hello World, BeanPostProcessor-style ......................................83
Example: The RequiredAnnotationBeanPostProcessor ..............................84
Customizing configuration metadata with a BeanFactoryPostProcessor ..............85
Example: the PropertyPlaceholderConfigurer ...........................................86
Example: the PropertyOverrideConfigurer ...............................................87
Customizing instantiation logic with a FactoryBean ..........................................88
4.9. Annotation-based container configuration ..........................................................89
@Required .....................................................................................................90
Spring Framework
3.1 Reference Documentation iv
@Autowired and @Inject ................................................................................91
Fine-tuning annotation-based autowiring with qualifiers ...................................94
CustomAutowireConfigurer ............................................................................99
@Resource ...................................................................................................100
@PostConstruct and @PreDestroy .................................................................101
4.10. Classpath scanning and managed components ................................................101
@Component and further stereotype annotations ............................................102
Automatically detecting classes and registering bean definitions ......................102
Using filters to customize scanning ................................................................103
Defining bean metadata within components ....................................................104
Naming autodetected components ..................................................................106
Providing a scope for autodetected components ..............................................107
Providing qualifier metadata with annotations ................................................107
4.11. Using JSR 330 standard annotations ..............................................................108
Dependency Injection with @Inject and @Named ..........................................109
@Named: a standard equivalent to the @Component annotation ......................109
Limitations of the standard approach ..............................................................110
4.12. Java-based container configuration ................................................................111
Basic concepts: @Configuration and @Bean ..................................................111
Instantiating the Spring container using AnnotationConfigApplicationContext .111
Simple construction ..............................................................................112
Building the container programmatically using register(Class<?>...) ........112
Enabling component scanning with scan(String...) ..................................112
Support for web applications with AnnotationConfigWebApplicationContext
.............................................................................................................113
Composing Java-based configurations ............................................................114
Using the @Import annotation ...............................................................114
Combining Java and XML configuration ................................................117
Using the @Bean annotation .........................................................................119
Declaring a bean ...................................................................................119
Injecting dependencies ..........................................................................120
Receiving lifecycle callbacks .................................................................120
Specifying bean scope ...........................................................................121
Customizing bean naming .....................................................................123
Bean aliasing ........................................................................................123
Further information about how Java-based configuration works internally ........123
4.13. Registering a LoadTimeWeaver ....................................................................124
4.14. Additional Capabilities of the ApplicationContext ..........................................125
Internationalization using MessageSource ......................................................125
Standard and Custom Events .........................................................................128
Convenient access to low-level resources .......................................................131
Convenient ApplicationContext instantiation for web applications ...................132
Deploying a Spring ApplicationContext as a J2EE RAR file ............................133
4.15. The BeanFactory ..........................................................................................133
BeanFactory or ApplicationContext? .............................................................134
Spring Framework
3.1 Reference Documentation v
剩余815页未读,继续阅读
lujunyun2008
- 粉丝: 5
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
- MW全能培训汽轮机调节保安系统PPT教学课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2