没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring框架官方参考文档
Spring框架官方参考文档
5星 · 超过95%的资源 需积分: 0 2 下载量 102 浏览量
更新于2024-07-25
收藏 4.16MB PDF 举报
"Spring技术文档,英文版,详细介绍了Spring框架的核心概念、模块、使用场景以及依赖管理等内容。"
Spring框架是Java开发中广泛使用的开源框架,以其强大的依赖注入(Dependency Injection,简称DI)和控制反转(Inversion of Control,简称IoC)为核心特性,极大地简化了企业级应用的开发。本技术文档全面覆盖了Spring的主要模块,包括:
1. **核心容器**(Core Container):这是Spring的基础,主要包括ApplicationContext和BeanFactory,它们负责管理应用程序的bean,提供IoC和DI功能。BeanFactory是Spring的基本容器,而ApplicationContext则在BeanFactory的基础上增加了国际化、事件传播、AOP支持等功能。
2. **数据访问/集成**(Data Access/Integration):这一部分涵盖了Spring对各种数据存储技术的支持,如JDBC、ORM(对象关系映射)框架如Hibernate和MyBatis,以及JPA(Java Persistence API)等。
3. **Web**:Spring提供了用于构建Web应用的模块,如Spring MVC,它是一个模型-视图-控制器框架,允许开发者创建高效、灵活的Web应用。
4. **面向切面编程(AOP)和Instrumentation**:AOP模块提供了声明式横切关注点的能力,例如日志记录、事务管理等。Instrumentation则支持类加载器和代理相关的功能。
5. **测试**(Test):Spring提供了测试支持,包括Mock对象、测试上下文框架等,方便进行单元测试和集成测试。
文档中还详细讨论了Spring的使用场景,包括如何在不同类型的项目中应用Spring框架,以及如何通过依赖管理来组织项目。Spring支持多种依赖管理方式:
- **Maven Dependency Management**:对于使用Maven构建的项目,Spring文档给出了如何在pom.xml中正确配置Spring依赖的指导。
- **Ivy Dependency Management**:对于使用Apache Ivy管理依赖的项目,也提供了相应的配置方法。
此外,文档还提到了日志配置,Spring支持多种日志框架,如Log4j、Java Util Logging等,并提供了统一的日志接口,使得日志配置更加灵活。
这份Spring技术文档是深入了解和学习Spring框架的重要资料,无论是初学者还是经验丰富的开发者,都能从中获益匪浅。通过阅读和实践,可以更深入地理解Spring的工作原理,提高开发效率,构建更稳定、可维护的Java应用。
The View - RequestToViewNameTranslator ..................................................485
16.12. ETag support ..............................................................................................486
16.13. Configuring Spring MVC ............................................................................487
mvc:annotation-driven ..................................................................................487
mvc:interceptors ...........................................................................................488
mvc:view-controller ......................................................................................489
mvc:resources ..............................................................................................489
mvc:default-servlet-handler ...........................................................................490
16.14. More Spring Web MVC Resources ..............................................................491
17. View technologies ...................................................................................................492
17.1. Introduction .................................................................................................492
17.2. JSP & JSTL .................................................................................................492
View resolvers .............................................................................................492
'Plain-old' JSPs versus JSTL ..........................................................................493
Additional tags facilitating development ........................................................493
Using Spring's form tag library ......................................................................493
Configuration .......................................................................................493
The form tag ........................................................................................494
The input tag ........................................................................................495
The checkbox tag ..................................................................................495
The checkboxes tag ..............................................................................497
The radiobutton tag ...............................................................................497
The radiobuttons tag .............................................................................498
The password tag ..................................................................................498
The select tag .......................................................................................498
The option tag ......................................................................................499
The options tag .....................................................................................499
The textarea tag ....................................................................................500
The hidden tag ......................................................................................500
The errors tag .......................................................................................501
HTTP Method Conversion ....................................................................503
17.3. Tiles ............................................................................................................503
Dependencies ...............................................................................................504
How to integrate Tiles ...................................................................................504
UrlBasedViewResolver .........................................................................504
ResourceBundleViewResolver ..............................................................505
SimpleSpringPreparerFactory and SpringBeanPreparerFactory ................505
17.4. Velocity & FreeMarker .................................................................................506
Dependencies ...............................................................................................506
Context configuration ...................................................................................506
Creating templates ........................................................................................507
Advanced configuration ................................................................................507
velocity.properties ................................................................................507
FreeMarker ..........................................................................................508
Bind support and form handling .....................................................................508
Spring Framework
3.1 Reference Documentation xvi
The bind macros ...................................................................................508
Simple binding .....................................................................................509
Form input generation macros ...............................................................510
HTML escaping and XHTML compliance .............................................514
17.5. XSLT ..........................................................................................................515
My First Words ............................................................................................515
Bean definitions ...................................................................................515
Standard MVC controller code ..............................................................515
Convert the model data to XML ............................................................516
Defining the view properties ..................................................................516
Document transformation ......................................................................517
Summary .....................................................................................................517
17.6. Document views (PDF/Excel) .......................................................................518
Introduction .................................................................................................518
Configuration and setup ................................................................................518
Document view definitions ....................................................................518
Controller code .....................................................................................518
Subclassing for Excel views ..................................................................519
Subclassing for PDF views ....................................................................520
17.7. JasperReports ...............................................................................................521
Dependencies ...............................................................................................521
Configuration ...............................................................................................521
Configuring the ViewResolver ..............................................................521
Configuring the Views ..........................................................................522
About Report Files ...............................................................................522
Using JasperReportsMultiFormatView ...................................................522
Populating the ModelAndView ......................................................................523
Working with Sub-Reports ............................................................................524
Configuring Sub-Report Files ................................................................524
Configuring Sub-Report Data Sources ...................................................525
Configuring Exporter Parameters ...................................................................525
17.8. Feed Views ..................................................................................................526
17.9. XML Marshalling View ................................................................................527
17.10. JSON Mapping View ..................................................................................527
18. Integrating with other web frameworks .....................................................................528
18.1. Introduction .................................................................................................528
18.2. Common configuration .................................................................................529
18.3. JavaServer Faces 1.1 and 1.2 .........................................................................530
DelegatingVariableResolver (JSF 1.1/1.2) ......................................................530
SpringBeanVariableResolver (JSF 1.1/1.2) .....................................................531
SpringBeanFacesELResolver (JSF 1.2+) ........................................................531
FacesContextUtils ........................................................................................532
18.4. Apache Struts 1.x and 2.x .............................................................................532
ContextLoaderPlugin ....................................................................................533
DelegatingRequestProcessor .................................................................533
Spring Framework
3.1 Reference Documentation xvii
DelegatingActionProxy .........................................................................534
ActionSupport Classes ..................................................................................535
18.5. WebWork 2.x ...............................................................................................535
18.6. Tapestry 3.x and 4.x .....................................................................................536
Injecting Spring-managed beans ....................................................................537
Dependency Injecting Spring Beans into Tapestry pages .........................538
Component definition files ....................................................................539
Adding abstract accessors ......................................................................540
Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x style
.............................................................................................................542
18.7. Further Resources .........................................................................................543
19. Portlet MVC Framework .........................................................................................544
19.1. Introduction .................................................................................................544
Controllers - The C in MVC ..........................................................................545
Views - The V in MVC .................................................................................545
Web-scoped beans ........................................................................................546
19.2. The DispatcherPortlet ...................................................................................546
19.3. The ViewRendererServlet .............................................................................548
19.4. Controllers ...................................................................................................549
AbstractController and PortletContentGenerator .............................................549
Other simple controllers ................................................................................551
Command Controllers ...................................................................................551
PortletWrappingController ............................................................................552
19.5. Handler mappings ........................................................................................552
PortletModeHandlerMapping ........................................................................553
ParameterHandlerMapping ............................................................................554
PortletModeParameterHandlerMapping .........................................................554
Adding HandlerInterceptors ..........................................................................555
HandlerInterceptorAdapter ............................................................................555
ParameterMappingInterceptor .......................................................................555
19.6. Views and resolving them .............................................................................556
19.7. Multipart (file upload) support ......................................................................556
Using the PortletMultipartResolver ................................................................557
Handling a file upload in a form ....................................................................557
19.8. Handling exceptions .....................................................................................560
19.9. Annotation-based controller configuration .....................................................561
Setting up the dispatcher for annotation support ..............................................561
Defining a controller with @Controller ..........................................................561
Mapping requests with @RequestMapping .....................................................562
Supported handler method arguments ............................................................563
Binding request parameters to method parameters with @RequestParam ..........565
Providing a link to data from the model with @ModelAttribute .......................566
Specifying attributes to store in a Session with @SessionAttributes .................566
Customizing WebDataBinder initialization .....................................................567
Customizing data binding with @InitBinder ...........................................567
Spring Framework
3.1 Reference Documentation xviii
Configuring a custom WebBindingInitializer ..........................................567
19.10. Portlet application deployment ....................................................................568
VI. Integration ......................................................................................................................569
20. Remoting and web services using Spring ..................................................................570
20.1. Introduction .................................................................................................570
20.2. Exposing services using RMI ........................................................................571
Exporting the service using the RmiServiceExporter .......................................571
Linking in the service at the client .................................................................572
20.3. Using Hessian or Burlap to remotely call services via HTTP ...........................573
Wiring up the DispatcherServlet for Hessian and co. .......................................573
Exposing your beans by using the HessianServiceExporter ..............................573
Linking in the service on the client ................................................................574
Using Burlap ................................................................................................574
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ..........................................................................................................575
20.4. Exposing services using HTTP invokers ........................................................575
Exposing the service object ...........................................................................575
Linking in the service at the client .................................................................576
20.5. Web services ................................................................................................577
Exposing servlet-based web services using JAX-RPC .....................................578
Accessing web services using JAX-RPC ........................................................578
Registering JAX-RPC Bean Mappings ...........................................................580
Registering your own JAX-RPC Handler .......................................................581
Exposing servlet-based web services using JAX-WS ......................................581
Exporting standalone web services using JAX-WS .........................................582
Exporting web services using the JAX-WS RI's Spring support .......................583
Accessing web services using JAX-WS ..........................................................583
20.6. JMS .............................................................................................................584
Server-side configuration ..............................................................................585
Client-side configuration ...............................................................................586
20.7. Auto-detection is not implemented for remote interfaces .................................587
20.8. Considerations when choosing a technology ...................................................587
20.9. Accessing RESTful services on the Client ......................................................588
RestTemplate ...............................................................................................588
Dealing with request and response headers .............................................590
HTTP Message Conversion ...........................................................................591
StringHttpMessageConverter .................................................................591
FormHttpMessageConverter ..................................................................591
ByteArrayMessageConverter .................................................................592
MarshallingHttpMessageConverter ........................................................592
MappingJacksonHttpMessageConverter .................................................592
SourceHttpMessageConverter ...............................................................592
BufferedImageHttpMessageConverter ...................................................592
21. Enterprise JavaBeans (EJB) integration ....................................................................593
21.1. Introduction .................................................................................................593
Spring Framework
3.1 Reference Documentation xix
21.2. Accessing EJBs ............................................................................................593
Concepts ......................................................................................................593
Accessing local SLSBs .................................................................................594
Accessing remote SLSBs ..............................................................................595
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ..............................................596
21.3. Using Spring's EJB implementation support classes ........................................596
EJB 2.x base classes .....................................................................................596
EJB 3 injection interceptor ............................................................................598
22. JMS (Java Message Service) ....................................................................................600
22.1. Introduction .................................................................................................600
22.2. Using Spring JMS ........................................................................................600
JmsTemplate ................................................................................................600
Connections .................................................................................................601
Caching Messaging Resources ...............................................................602
SingleConnectionFactory ......................................................................602
CachingConnectionFactory ...................................................................602
Destination Management ...............................................................................602
Message Listener Containers .........................................................................603
SimpleMessageListenerContainer ..........................................................604
DefaultMessageListenerContainer .........................................................604
Transaction management ...............................................................................604
22.3. Sending a Message .......................................................................................605
Using Message Converters ............................................................................606
SessionCallback and ProducerCallback ..........................................................607
22.4. Receiving a message .....................................................................................607
Synchronous Reception .................................................................................607
Asynchronous Reception - Message-Driven POJOs ........................................607
The SessionAwareMessageListener interface .................................................608
The MessageListenerAdapter ........................................................................608
Processing messages within transactions ........................................................610
22.5. Support for JCA Message Endpoints ..............................................................611
22.6. JMS Namespace Support ..............................................................................613
23. JMX .......................................................................................................................618
23.1. Introduction .................................................................................................618
23.2. Exporting your beans to JMX ........................................................................618
Creating an MBeanServer .............................................................................619
Reusing an existing MBeanServer .................................................................620
Lazy-initialized MBeans ...............................................................................621
Automatic registration of MBeans .................................................................621
Controlling the registration behavior ..............................................................621
23.3. Controlling the management interface of your beans .......................................623
The MBeanInfoAssembler Interface ..............................................................623
Using Source-Level Metadata (JDK 5.0 annotations) ......................................623
Source-Level Metadata Types .......................................................................625
The AutodetectCapableMBeanInfoAssembler interface ...................................627
Spring Framework
3.1 Reference Documentation xx
剩余836页未读,继续阅读
111 浏览量
2010-03-17 上传
154 浏览量
507 浏览量
354 浏览量
点击了解资源详情
紫守笨
- 粉丝: 55
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- AxureUX 交互原型Web元件库精简版.zip
- 数据插值与回归_待定系数插值_拉格朗日插值_matlab_工程数值计算_
- goit-markup-hw-01:№1
- 金融风控-数据集
- 标准马丁策略 _双币对冲EA_趋势EA_顺势网格EA_
- Choco-Balls-2
- android-criminalintent:由 Big Nerd Ranch Android 培训制作的 Android 应用
- opencensus-node:统计收集和分布式跟踪框架
- 运营级打赏直播源码 带支付+app封装 .rar
- Wpmaker:切换桌面墙纸并生成拼贴。-开源
- Code-Store
- Baidu Rec_表情识别_rec_基于百度API的表情识别_facialexpression_99.rec网站获取_
- test-graylog-ansible-role:使用Vagrant测试Graylog Ansible角色
- 二次开发威客任务平台源码 粉丝关注投票发布系统 已对接码支付完美运营 可封装app .rar
- Heart-Rate-Monitor-:基于Android的心率测量应用程序,可测量来自传感器的值并将其存储在云中
- Dev-Cpp_5.11_TDM-GCC_4.9.2_Setup.exe.zip
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功