没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring 3.2.1 API详解:依赖注入与模块化架构
Spring 3.2.1 API详解:依赖注入与模块化架构
需积分: 9 0 下载量 149 浏览量
更新于2024-07-26
收藏 4.53MB PDF 举报
Spring 3.0 API 是Spring Framework官方文档的一个版本,它详细介绍了Spring框架的各个方面,包括其核心特性、设计理念以及在不同场景下的应用。Spring Framework是由Rod Johnson、Juergen Hoeller等众多开发者共同创建的开源框架,主要目标是提供依赖注入(Dependency Injection, DI)和控制反转(Inversion of Control, IoC)机制,简化企业级Java应用程序的开发和管理。
该文档首先概述了Spring Framework的整体架构和概念。其中,第1章“Introduction to Spring Framework”涵盖了Spring的主要特点,如DI和IoC,这些技术有助于解耦组件,提高代码的可测试性和灵活性。章节中还讨论了Spring的模块划分,包括核心容器(Core Container)、数据访问/集成(Data Access/Integration)、Web支持、面向切面编程(AOP)与监控(Instrumentation),以及测试支持。
此外,文档还提到了Spring的使用场景(Usagescenarios),帮助开发者理解如何在实际项目中选择和应用不同的Spring组件。Spring 3.2.1.RELEASE 版本特别强调了依赖管理(Dependency Management)和命名约定(Naming Conventions),这些都是确保项目结构清晰、可维护的关键要素。
版权方面,Spring Framework的3.2.1版本文档允许用户复制用于个人学习或与他人分享,但必须确保不收取费用,并且每份复制必须包含版权声明,无论是纸质还是电子形式分发。
Spring 3.0 API是开发人员理解和使用Spring框架的重要参考资料,涵盖了从基础概念到高级特性的全面指南,对于任何希望通过Spring简化Java应用开发的开发者来说,都是不可或缺的工具。
Spring Framework
3.2.1.RELEASE
Spring Framework
Reference Documentation xvi
Using Spring's form tag library ........................................................................ 509
Configuration .......................................................................................... 509
The form tag ......................................................................................... 509
The input tag ....................................................................................... 511
The checkbox tag ................................................................................. 511
The checkboxes tag ............................................................................. 514
The radiobutton tag ........................................................................... 514
The radiobuttons tag ......................................................................... 515
The password tag ................................................................................. 515
The select tag ..................................................................................... 515
The option tag ..................................................................................... 516
The options tag ................................................................................... 516
The textarea tag ................................................................................. 517
The hidden tag ..................................................................................... 517
The errors tag ..................................................................................... 517
HTTP Method Conversion ....................................................................... 520
HTML5 Tags .......................................................................................... 521
18.3. Tiles .............................................................................................................. 521
Dependencies ................................................................................................ 521
How to integrate Tiles ..................................................................................... 521
UrlBasedViewResolver .................................................................... 522
ResourceBundleViewResolver ........................................................ 522
SimpleSpringPreparerFactory and
SpringBeanPreparerFactory ............................................................ 522
18.4. Velocity & FreeMarker .................................................................................... 523
Dependencies ................................................................................................ 523
Context configuration ...................................................................................... 523
Creating templates ......................................................................................... 524
Advanced configuration ................................................................................... 525
velocity.properties ................................................................................... 525
FreeMarker ............................................................................................. 525
Bind support and form handling ....................................................................... 526
The bind macros .................................................................................... 526
Simple binding ........................................................................................ 526
Form input generation macros ................................................................. 527
HTML escaping and XHTML compliance ................................................. 531
18.5. XSLT ............................................................................................................. 532
My First Words ............................................................................................... 532
Bean definitions ...................................................................................... 532
Standard MVC controller code ................................................................. 532
Convert the model data to XML ............................................................... 533
Defining the view properties .................................................................... 533
Document transformation ........................................................................ 534
Summary ....................................................................................................... 534
18.6. Document views (PDF/Excel) .......................................................................... 535
Introduction .................................................................................................... 535
Configuration and setup .................................................................................. 535
Document view definitions ....................................................................... 535
Controller code ....................................................................................... 535
Subclassing for Excel views .................................................................... 535
Spring Framework
3.2.1.RELEASE
Spring Framework
Reference Documentation xvii
Subclassing for PDF views ..................................................................... 537
18.7. JasperReports ............................................................................................... 538
Dependencies ................................................................................................ 538
Configuration .................................................................................................. 538
Configuring the ViewResolver .............................................................. 538
Configuring the Views ............................................................................ 538
About Report Files .................................................................................. 539
Using JasperReportsMultiFormatView ............................................. 539
Populating the ModelAndView ....................................................................... 540
Working with Sub-Reports ............................................................................... 541
Configuring Sub-Report Files .................................................................. 541
Configuring Sub-Report Data Sources ..................................................... 542
Configuring Exporter Parameters ..................................................................... 542
18.8. Feed Views ................................................................................................... 542
18.9. XML Marshalling View .................................................................................... 543
18.10. JSON Mapping View .................................................................................... 544
19. Integrating with other web frameworks ....................................................................... 545
19.1. Introduction .................................................................................................... 545
19.2. Common configuration ................................................................................... 546
19.3. JavaServer Faces 1.1 and 1.2 ........................................................................ 547
DelegatingVariableResolver (JSF 1.1/1.2) ........................................................ 547
SpringBeanVariableResolver (JSF 1.1/1.2) ....................................................... 548
SpringBeanFacesELResolver (JSF 1.2+) ......................................................... 548
FacesContextUtils ........................................................................................... 548
19.4. Apache Struts 1.x and 2.x .............................................................................. 549
ContextLoaderPlugin ....................................................................................... 549
DelegatingRequestProcessor ................................................................... 550
DelegatingActionProxy ............................................................................ 550
ActionSupport Classes .................................................................................... 551
19.5. WebWork 2.x ................................................................................................. 551
19.6. Tapestry 3.x and 4.x ...................................................................................... 552
Injecting Spring-managed beans ..................................................................... 553
Dependency Injecting Spring Beans into Tapestry pages ........................... 555
Component definition files ....................................................................... 556
Adding abstract accessors ...................................................................... 557
Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x
style ....................................................................................................... 559
19.7. Further Resources ......................................................................................... 560
20. Portlet MVC Framework ............................................................................................ 561
20.1. Introduction .................................................................................................... 561
Controllers - The C in MVC ............................................................................ 562
Views - The V in MVC .................................................................................... 562
Web-scoped beans ......................................................................................... 562
20.2. The DispatcherPortlet ............................................................................ 562
20.3. The ViewRendererServlet ........................................................................ 564
20.4. Controllers ..................................................................................................... 565
AbstractController and PortletContentGenerator ............................. 566
Other simple controllers .................................................................................. 567
Command Controllers ..................................................................................... 567
PortletWrappingController .................................................................... 568
Spring Framework
3.2.1.RELEASE
Spring Framework
Reference Documentation xviii
20.5. Handler mappings .......................................................................................... 568
PortletModeHandlerMapping .................................................................... 569
ParameterHandlerMapping ........................................................................ 569
PortletModeParameterHandlerMapping .................................................. 570
Adding HandlerInterceptors ..................................................................... 570
HandlerInterceptorAdapter .................................................................... 571
ParameterMappingInterceptor ................................................................ 571
20.6. Views and resolving them .............................................................................. 571
20.7. Multipart (file upload) support ......................................................................... 572
Using the PortletMultipartResolver ....................................................... 572
Handling a file upload in a form ...................................................................... 573
20.8. Handling exceptions ....................................................................................... 576
20.9. Annotation-based controller configuration ........................................................ 576
Setting up the dispatcher for annotation support ............................................... 576
Defining a controller with @Controller .......................................................... 577
Mapping requests with @RequestMapping ..................................................... 578
Supported handler method arguments ............................................................. 579
Binding request parameters to method parameters with @RequestParam .......... 581
Providing a link to data from the model with @ModelAttribute ....................... 581
Specifying attributes to store in a Session with @SessionAttributes ............. 582
Customizing WebDataBinder initialization ...................................................... 582
Customizing data binding with @InitBinder .......................................... 582
Configuring a custom WebBindingInitializer ................................... 583
20.10. Portlet application deployment ...................................................................... 583
VI. Integration ......................................................................................................................... 584
21. Remoting and web services using Spring ................................................................... 585
21.1. Introduction .................................................................................................... 585
21.2. Exposing services using RMI .......................................................................... 586
Exporting the service using the RmiServiceExporter ................................... 586
Linking in the service at the client ................................................................... 587
21.3. Using Hessian or Burlap to remotely call services via HTTP .............................. 587
Wiring up the DispatcherServlet for Hessian and co. ................................. 587
Exposing your beans by using the HessianServiceExporter ....................... 588
Linking in the service on the client .................................................................. 589
Using Burlap .................................................................................................. 589
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ............................................................................................................ 589
21.4. Exposing services using HTTP invokers .......................................................... 590
Exposing the service object ............................................................................ 590
Linking in the service at the client ................................................................... 591
21.5. Web services ................................................................................................. 591
Exposing servlet-based web services using JAX-RPC ....................................... 592
Accessing web services using JAX-RPC .......................................................... 593
Registering JAX-RPC Bean Mappings ............................................................. 595
Registering your own JAX-RPC Handler .......................................................... 595
Exposing servlet-based web services using JAX-WS ........................................ 596
Exporting standalone web services using JAX-WS ........................................... 597
Exporting web services using the JAX-WS RI's Spring support .......................... 598
Accessing web services using JAX-WS ........................................................... 598
21.6. JMS .............................................................................................................. 599
Spring Framework
3.2.1.RELEASE
Spring Framework
Reference Documentation xix
Server-side configuration ................................................................................. 600
Client-side configuration .................................................................................. 601
21.7. Auto-detection is not implemented for remote interfaces ................................... 602
21.8. Considerations when choosing a technology .................................................... 602
21.9. Accessing RESTful services on the Client ....................................................... 603
RestTemplate ................................................................................................. 603
Working with the URI .............................................................................. 605
Dealing with request and response headers ............................................. 606
HTTP Message Conversion ............................................................................ 606
StringHttpMessageConverter ................................................................... 607
FormHttpMessageConverter .................................................................... 607
ByteArrayHttpMessageConverter ............................................................. 607
MarshallingHttpMessageConverter ........................................................... 607
MappingJackson2HttpMessageConverter (or
MappingJacksonHttpMessageConverter with Jackson 1.x) ........................ 608
SourceHttpMessageConverter ................................................................. 608
BufferedImageHttpMessageConverter ...................................................... 608
22. Enterprise JavaBeans (EJB) integration ..................................................................... 609
22.1. Introduction .................................................................................................... 609
22.2. Accessing EJBs ............................................................................................. 609
Concepts ........................................................................................................ 609
Accessing local SLSBs ................................................................................... 609
Accessing remote SLSBs ................................................................................ 611
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ............................................... 611
22.3. Using Spring's EJB implementation support classes ......................................... 612
EJB 2.x base classes ..................................................................................... 612
EJB 3 injection interceptor .............................................................................. 614
23. JMS (Java Message Service) .................................................................................... 616
23.1. Introduction .................................................................................................... 616
23.2. Using Spring JMS .......................................................................................... 616
JmsTemplate ................................................................................................ 616
Connections ................................................................................................... 617
Caching Messaging Resources ............................................................... 617
SingleConnectionFactory ......................................................................... 617
CachingConnectionFactory ...................................................................... 618
Destination Management ................................................................................. 618
Message Listener Containers .......................................................................... 619
SimpleMessageListenerContainer ............................................................ 619
DefaultMessageListenerContainer ............................................................ 619
Transaction management ................................................................................ 619
23.3. Sending a Message ....................................................................................... 620
Using Message Converters ............................................................................. 621
SessionCallback and ProducerCallback ................................................ 622
23.4. Receiving a message ..................................................................................... 622
Synchronous Reception .................................................................................. 622
Asynchronous Reception - Message-Driven POJOs .......................................... 622
The SessionAwareMessageListener interface ........................................... 623
The MessageListenerAdapter ................................................................... 624
Processing messages within transactions ........................................................ 625
23.5. Support for JCA Message Endpoints ............................................................... 626
Spring Framework
3.2.1.RELEASE
Spring Framework
Reference Documentation xx
23.6. JMS Namespace Support ............................................................................... 628
24. JMX ......................................................................................................................... 632
24.1. Introduction .................................................................................................... 632
24.2. Exporting your beans to JMX .......................................................................... 632
Creating an MBeanServer ............................................................................. 634
Reusing an existing MBeanServer ................................................................. 634
Lazy-initialized MBeans ................................................................................... 635
Automatic registration of MBeans .................................................................... 635
Controlling the registration behavior ................................................................. 636
24.3. Controlling the management interface of your beans ........................................ 637
The MBeanInfoAssembler Interface ............................................................. 637
Using Source-Level Metadata (JDK 5.0 annotations) ........................................ 637
Source-Level Metadata Types ......................................................................... 639
The AutodetectCapableMBeanInfoAssembler interface ............................ 641
Defining management interfaces using Java interfaces ..................................... 641
Using MethodNameBasedMBeanInfoAssembler ........................................... 643
24.4. Controlling the ObjectNames for your beans .................................................. 643
Reading ObjectNames from Properties ...................................................... 643
Using the MetadataNamingStrategy ........................................................... 644
Configuring annotation based MBean export .................................................... 645
24.5. JSR-160 Connectors ...................................................................................... 646
Server-side Connectors ................................................................................... 646
Client-side Connectors .................................................................................... 647
JMX over Burlap/Hessian/SOAP ...................................................................... 647
24.6. Accessing MBeans via Proxies ....................................................................... 647
24.7. Notifications ................................................................................................... 648
Registering Listeners for Notifications .............................................................. 648
Publishing Notifications ................................................................................... 652
24.8. Further Resources ......................................................................................... 654
25. JCA CCI .................................................................................................................. 655
25.1. Introduction .................................................................................................... 655
25.2. Configuring CCI ............................................................................................. 655
Connector configuration .................................................................................. 655
ConnectionFactory configuration in Spring ................................................. 656
Configuring CCI connections ........................................................................... 656
Using a single CCI connection ........................................................................ 657
25.3. Using Spring's CCI access support ................................................................. 658
Record conversion .......................................................................................... 658
The CciTemplate ......................................................................................... 659
DAO support .................................................................................................. 660
Automatic output record generation ................................................................. 660
Summary ....................................................................................................... 661
Using a CCI Connection and Interaction directly ...................................... 662
Example for CciTemplate usage ................................................................... 663
25.4. Modeling CCI access as operation objects ...................................................... 665
MappingRecordOperation .......................................................................... 665
MappingCommAreaOperation ...................................................................... 665
Automatic output record generation ................................................................. 666
Summary ....................................................................................................... 666
Example for MappingRecordOperation usage ............................................. 666
剩余843页未读,继续阅读
2012-03-05 上传
2008-12-08 上传
2012-08-16 上传
2011-02-21 上传
2015-04-12 上传
2010-03-18 上传
4128 浏览量
panpan1234
- 粉丝: 42
- 资源: 48
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 平尾装配工作平台运输支撑系统设计与应用
- MAX-MIN Ant System:用MATLAB解决旅行商问题
- Flutter状态管理新秀:sealed_flutter_bloc包整合seal_unions
- Pong²开源游戏:双人对战图形化的经典竞技体验
- jQuery spriteAnimator插件:创建精灵动画的利器
- 广播媒体对象传输方法与设备的技术分析
- MATLAB HDF5数据提取工具:深层结构化数据处理
- 适用于arm64的Valgrind交叉编译包发布
- 基于canvas和Java后端的小程序“飞翔的小鸟”完整示例
- 全面升级STM32F7 Discovery LCD BSP驱动程序
- React Router v4 入门教程与示例代码解析
- 下载OpenCV各版本安装包,全面覆盖2.4至4.5
- 手写笔画分割技术的新突破:智能分割方法与装置
- 基于Koplowitz & Bruckstein算法的MATLAB周长估计方法
- Modbus4j-3.0.3版本免费下载指南
- PoqetPresenter:Sharp Zaurus上的开源OpenOffice演示查看器
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功