没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring Framework 4.0.3 开发指南
Spring Framework 4.0.3 开发指南

"Spring Framework 4.0.3 开发文档"
Spring Framework 是一个全面的Java应用开发框架,它提供了一种强大的方式来组织和构建应用程序。4.0.3版本是该框架的一个重要里程碑,引入了许多增强功能和改进,旨在提高开发效率和应用的稳定性。
在"最新spring4.0.3框架开发文档"中,你可以找到关于Spring Framework的详尽信息,包括核心概念、模块划分、使用场景以及最佳实践。这份文档由Rod Johnson、Juergen Hoeller等多位知名开发者共同编写,确保了内容的专业性和权威性。
1. **概述** (Overview of Spring Framework)
- **入门指南** (Getting Started With Spring):这部分通常会介绍如何配置开发环境,安装必要的库,并创建第一个Spring驱动的应用程序。
- **Spring Framework简介** (Introduction to Spring Framework)
- **依赖注入和控制反转** (Dependency Injection and Inversion of Control):Spring的核心特性之一,它允许开发者通过声明式的方式管理对象间的依赖关系,减少代码间的耦合度。
- **模块** (Modules)
- **核心容器** (Core Container):包括ApplicationContext和Bean工厂,是Spring的基础,负责bean的生命周期管理和配置。
- **数据访问/集成** (Data Access/Integration):支持多种数据库访问技术,如JDBC、ORM(Hibernate、JPA)和OXM(对象/XML映射)。
- **Web**:为构建Web应用程序提供支持,包括Spring MVC和WebSocket等。
- **面向切面编程(AOP)和工具** (AOP and Instrumentation):提供面向切面编程的实现,可以方便地进行横切关注点的管理。
- **测试** (Test):集成测试工具和策略,帮助开发者进行单元测试和集成测试。
2. **使用场景** (Usage scenarios)
- 这部分会介绍Spring在不同应用类型和业务场景中的最佳实践,例如企业级应用、服务化、微服务架构等。
3. **目录结构** (Table of Contents)
- 文档通常会按照章节和子章节详细展开,涵盖了从基本概念到高级特性的所有内容。
4. **版权与许可** (Copyright and Licensing)
- Spring Framework的文档遵循特定的版权规定,允许免费复制和分发,但禁止收费。
5. **其他内容**
- 除了上述内容,文档还可能包含错误修正、API参考、示例代码、性能调优指南以及与其他技术(如Spring Boot、Spring Cloud等)的集成信息。
通过深入阅读和理解这份开发文档,开发者能够更好地掌握Spring Framework的精髓,提升开发效率,同时也能利用其强大的功能来构建高效、可维护的Java应用。

Spring Framework
4.0.0.RELEASE
Spring Framework
Reference Documentation xvi
Introduction .................................................................................................... 532
Configuration and setup .................................................................................. 532
Document view definitions ....................................................................... 532
Controller code ....................................................................................... 532
Subclassing for Excel views .................................................................... 532
Subclassing for PDF views ..................................................................... 534
17.7. JasperReports ............................................................................................... 534
Dependencies ................................................................................................ 534
Configuration .................................................................................................. 535
Configuring the ViewResolver .................................................................. 535
Configuring the Views ............................................................................. 535
About Report Files .................................................................................. 535
Using JasperReportsMultiFormatView ...................................................... 536
Populating the ModelAndView ......................................................................... 536
Working with Sub-Reports ............................................................................... 537
Configuring Sub-Report Files .................................................................. 537
Configuring Sub-Report Data Sources ..................................................... 538
Configuring Exporter Parameters ..................................................................... 538
17.8. Feed Views ................................................................................................... 539
17.9. XML Marshalling View .................................................................................... 540
17.10. JSON Mapping View .................................................................................... 540
18. Integrating with other web frameworks ....................................................................... 541
18.1. Introduction .................................................................................................... 541
18.2. Common configuration ................................................................................... 542
18.3. JavaServer Faces 1.2 .................................................................................... 543
SpringBeanFacesELResolver (JSF 1.2+) ......................................................... 543
FacesContextUtils ........................................................................................... 543
18.4. Apache Struts 2.x .......................................................................................... 544
18.5. Tapestry 5.x .................................................................................................. 544
18.6. Further Resources ......................................................................................... 544
19. Portlet MVC Framework ............................................................................................ 545
19.1. Introduction .................................................................................................... 545
Controllers - The C in MVC ............................................................................ 546
Views - The V in MVC .................................................................................... 546
Web-scoped beans ......................................................................................... 546
19.2. The DispatcherPortlet ..................................................................................... 546
19.3. The ViewRendererServlet ............................................................................... 548
19.4. Controllers ..................................................................................................... 549
AbstractController and PortletContentGenerator ............................................... 550
Other simple controllers .................................................................................. 551
Command Controllers ..................................................................................... 551
PortletWrappingController ................................................................................ 552
19.5. Handler mappings .......................................................................................... 552
PortletModeHandlerMapping ............................................................................ 553
ParameterHandlerMapping .............................................................................. 553
PortletModeParameterHandlerMapping ............................................................ 554
Adding HandlerInterceptors ............................................................................. 554
HandlerInterceptorAdapter ............................................................................... 555
ParameterMappingInterceptor .......................................................................... 555
19.6. Views and resolving them .............................................................................. 555

Spring Framework
4.0.0.RELEASE
Spring Framework
Reference Documentation xvii
19.7. Multipart (file upload) support ......................................................................... 556
Using the PortletMultipartResolver ................................................................... 556
Handling a file upload in a form ...................................................................... 557
19.8. Handling exceptions ....................................................................................... 560
19.9. Annotation-based controller configuration ........................................................ 560
Setting up the dispatcher for annotation support ............................................... 560
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 ............................ 565
Specifying attributes to store in a Session with @SessionAttributes .................... 566
Customizing WebDataBinder initialization ......................................................... 566
Customizing data binding with @InitBinder ............................................... 567
Configuring a custom WebBindingInitializer .............................................. 567
19.10. Portlet application deployment ...................................................................... 567
20. WebSocket Support .................................................................................................. 569
20.1. Introduction .................................................................................................... 569
Fallback Options ............................................................................................. 569
Messaging Architecture ................................................................................... 569
Sub-Protocol Support ...................................................................................... 570
When To Use WebSocket? ............................................................................. 570
20.2. WebSocket Server ......................................................................................... 571
Create and Configure a WebSocketHandler ..................................................... 571
Customizing the WebSocket Handshake .......................................................... 572
WebSocketHandler Decoration ........................................................................ 573
Deployment Considerations ............................................................................. 573
20.3. Fallback Options ............................................................................................ 575
Enable SockJS ............................................................................................... 575
How SockJS Works ........................................................................................ 576
Spring’s SockJS Support ................................................................................ 576
20.4. STOMP Messaging ........................................................................................ 576
Overview of STOMP ....................................................................................... 577
Enable STOMP (over WebSocket) .................................................................. 578
Overview of STOMP Message Handling .......................................................... 579
Annotation-based Message Handling ....................................................... 581
Sending Messages From Anywhere ......................................................... 582
Simple Message Broker .......................................................................... 583
Using a Full-Featured Message Broker .................................................... 583
Handling Messages to User Destinations ................................................. 584
VI. Integration ......................................................................................................................... 586
21. Remoting and web services using Spring ................................................................... 587
21.1. Introduction .................................................................................................... 587
21.2. Exposing services using RMI .......................................................................... 588
Exporting the service using the RmiServiceExporter ......................................... 588
Linking in the service at the client ................................................................... 589
21.3. Using Hessian or Burlap to remotely call services via HTTP .............................. 589
Wiring up the DispatcherServlet for Hessian and co. ......................................... 589
Exposing your beans by using the HessianServiceExporter ............................... 590
Linking in the service on the client .................................................................. 591

Spring Framework
4.0.0.RELEASE
Spring Framework
Reference Documentation xviii
Using Burlap .................................................................................................. 591
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ............................................................................................................ 591
21.4. Exposing services using HTTP invokers .......................................................... 592
Exposing the service object ............................................................................ 592
Linking in the service at the client ................................................................... 593
21.5. Web services ................................................................................................. 593
Exposing servlet-based web services using JAX-WS ........................................ 594
Exporting standalone web services using JAX-WS ........................................... 595
Exporting web services using the JAX-WS RI’s Spring support .......................... 595
Accessing web services using JAX-WS ........................................................... 596
21.6. JMS .............................................................................................................. 597
Server-side configuration ................................................................................. 597
Client-side configuration .................................................................................. 598
21.7. AMQP ........................................................................................................... 599
21.8. Auto-detection is not implemented for remote interfaces ................................... 599
21.9. Considerations when choosing a technology .................................................... 599
21.10. Accessing RESTful services on the Client ..................................................... 600
RestTemplate ................................................................................................. 600
Working with the URI .............................................................................. 603
Dealing with request and response headers ............................................. 603
HTTP Message Conversion ............................................................................ 604
StringHttpMessageConverter ................................................................... 604
FormHttpMessageConverter .................................................................... 605
ByteArrayHttpMessageConverter ............................................................. 605
MarshallingHttpMessageConverter ........................................................... 605
MappingJackson2HttpMessageConverter (or
MappingJacksonHttpMessageConverter with Jackson 1.x) ........................ 605
SourceHttpMessageConverter ................................................................. 605
BufferedImageHttpMessageConverter ...................................................... 605
Async RestTemplate ....................................................................................... 605
22. Enterprise JavaBeans (EJB) integration ..................................................................... 607
22.1. Introduction .................................................................................................... 607
22.2. Accessing EJBs ............................................................................................. 607
Concepts ........................................................................................................ 607
Accessing local SLSBs ................................................................................... 607
Accessing remote SLSBs ................................................................................ 609
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ............................................... 609
22.3. Using Spring’s EJB implementation support classes ......................................... 610
EJB 3 injection interceptor .............................................................................. 610
23. JMS (Java Message Service) .................................................................................... 611
23.1. Introduction .................................................................................................... 611
23.2. Using Spring JMS .......................................................................................... 611
JmsTemplate .................................................................................................. 611
Connections ................................................................................................... 612
Caching Messaging Resources ............................................................... 612
SingleConnectionFactory ......................................................................... 612
CachingConnectionFactory ...................................................................... 613
Destination Management ................................................................................. 613
Message Listener Containers .......................................................................... 614

Spring Framework
4.0.0.RELEASE
Spring Framework
Reference Documentation xix
SimpleMessageListenerContainer ............................................................ 614
DefaultMessageListenerContainer ............................................................ 614
Transaction management ................................................................................ 614
23.3. Sending a Message ....................................................................................... 615
Using Message Converters ............................................................................. 616
SessionCallback and ProducerCallback ........................................................... 617
23.4. Receiving a message ..................................................................................... 617
Synchronous Reception .................................................................................. 617
Asynchronous Reception - Message-Driven POJOs .......................................... 617
the SessionAwareMessageListener interface .................................................... 618
the MessageListenerAdapter ........................................................................... 619
Processing messages within transactions ........................................................ 621
23.5. Support for JCA Message Endpoints ............................................................... 621
23.6. JMS Namespace Support ............................................................................... 623
24. JMX ......................................................................................................................... 627
24.1. Introduction .................................................................................................... 627
24.2. Exporting your beans to JMX .......................................................................... 627
Creating an MBeanServer ............................................................................... 629
Reusing an existing MBeanServer ................................................................... 629
Lazy-initialized MBeans ................................................................................... 630
Automatic registration of MBeans .................................................................... 630
Controlling the registration behavior ................................................................. 630
24.3. Controlling the management interface of your beans ........................................ 632
the MBeanInfoAssembler Interface .................................................................. 632
Using Source-Level Metadata (JDK 5.0 annotations) ........................................ 632
Source-Level Metadata Types ......................................................................... 634
the AutodetectCapableMBeanInfoAssembler interface ...................................... 635
Defining management interfaces using Java interfaces ..................................... 636
Using MethodNameBasedMBeanInfoAssembler ............................................... 638
24.4. Controlling the ObjectNames for your beans .................................................... 638
Reading ObjectNames from Properties ............................................................ 638
Using the MetadataNamingStrategy ................................................................. 639
Configuring annotation based MBean export .................................................... 640
24.5. JSR-160 Connectors ...................................................................................... 641
Server-side Connectors ................................................................................... 641
Client-side Connectors .................................................................................... 642
JMX over Burlap/Hessian/SOAP ...................................................................... 642
24.6. Accessing MBeans via Proxies ....................................................................... 642
24.7. Notifications ................................................................................................... 643
Registering Listeners for Notifications .............................................................. 643
Publishing Notifications ................................................................................... 647
24.8. Further Resources ......................................................................................... 649
25. JCA CCI .................................................................................................................. 650
25.1. Introduction .................................................................................................... 650
25.2. Configuring CCI ............................................................................................. 650
Connector configuration .................................................................................. 650
ConnectionFactory configuration in Spring ....................................................... 651
Configuring CCI connections ........................................................................... 651
Using a single CCI connection ........................................................................ 652
25.3. Using Spring’s CCI access support ................................................................. 653

Spring Framework
4.0.0.RELEASE
Spring Framework
Reference Documentation xx
Record conversion .......................................................................................... 653
the CciTemplate ............................................................................................. 654
DAO support .................................................................................................. 655
Automatic output record generation ................................................................. 656
Summary ....................................................................................................... 656
Using a CCI Connection and Interaction directly ............................................... 657
Example for CciTemplate usage ...................................................................... 658
25.4. Modeling CCI access as operation objects ...................................................... 660
MappingRecordOperation ................................................................................ 660
MappingCommAreaOperation .......................................................................... 661
Automatic output record generation ................................................................. 662
Summary ....................................................................................................... 662
Example for MappingRecordOperation usage ................................................... 662
Example for MappingCommAreaOperation usage ............................................. 664
25.5. Transactions .................................................................................................. 666
26. Email ....................................................................................................................... 668
26.1. Introduction .................................................................................................... 668
26.2. Usage ........................................................................................................... 668
Basic MailSender and SimpleMailMessage usage ............................................ 669
Using the JavaMailSender and the MimeMessagePreparator ............................. 670
26.3. Using the JavaMail MimeMessageHelper ........................................................ 671
Sending attachments and inline resources ....................................................... 671
Attachments ........................................................................................... 671
Inline resources ...................................................................................... 672
Creating email content using a templating library .............................................. 672
A Velocity-based example ....................................................................... 672
27. Task Execution and Scheduling ................................................................................. 676
27.1. Introduction .................................................................................................... 676
27.2. The Spring TaskExecutor abstraction .............................................................. 676
TaskExecutor types ........................................................................................ 676
Using a TaskExecutor ..................................................................................... 677
27.3. The Spring TaskScheduler abstraction ............................................................ 678
the Trigger interface ....................................................................................... 679
Trigger implementations .................................................................................. 679
TaskScheduler implementations ...................................................................... 680
27.4. Annotation Support for Scheduling and Asynchronous Execution ....................... 680
Enable scheduling annotations ........................................................................ 680
The @Scheduled Annotation ........................................................................... 681
The @Async Annotation ................................................................................. 682
Executor qualification with @Async ................................................................. 683
27.5. The Task Namespace .................................................................................... 683
The scheduler element ................................................................................... 683
The executor element ..................................................................................... 684
The scheduled-tasks element .......................................................................... 685
27.6. Using the Quartz Scheduler ............................................................................ 685
Using the JobDetailBean ................................................................................. 685
Using the MethodInvokingJobDetailFactoryBean .............................................. 686
Wiring up jobs using triggers and the SchedulerFactoryBean ............................. 687
28. Dynamic language support ........................................................................................ 689
28.1. Introduction .................................................................................................... 689
剩余826页未读,继续阅读
290 浏览量
364 浏览量
点击了解资源详情
153 浏览量
2014-03-27 上传
353 浏览量
2014-04-25 上传
153 浏览量
153 浏览量

Ripon
- 粉丝: 0
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

最新资源
- 德语命名实体识别:NE2vec模型应用小教程
- LaTeX mcode宏包使用与源码解析
- NimbusKit框架:运行时的高效实现
- wtf-forms:跨浏览器的友好HTML表单控件与CSS技巧
- af3.0首个演示案例:RumenDemo深度体验
- Arduino UNO控制LED点矩阵接口开发简易指南
- 精选科学计算软件:数值分析与线性代数解决方案
- 构建Android可发布的pocketsphinx文件教程
- VS Code配置C语言开发环境与调试指南
- 深入解析duilib DirectUI界面库的应用与开发
- Emacs专业主题:Vim风格的Emacs主题新选择
- 第六届蓝桥杯省赛:单片机温度记录器设计
- Apache Maven 3.2.1版本发布,压缩包下载指南
- VC++实现右下角新闻窗口弹出效果示例
- 掌握SSH框架全英文API手册(版本2.2.3.1/4.0/3.0.5)
- HTML压缩包子文件处理技术解析
安全验证
文档复制为VIP权益,开通VIP直接复制
