没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring Framework 4.0 官方参考文档PDF版
"Spring Framework 4.0 Reference 是官方文档的英文PDF版本,包含了Spring框架4.0.4.RELEASE的详细信息,涵盖了依赖注入、模块结构、核心容器、数据访问/集成、Web支持以及AOP和Instrumentation等内容。这份文档由多位Spring社区的重要贡献者编写,版权属于2004-2014年的Spring源创者们。"
Spring Framework 4.0 是一个全面的企业级应用开发框架,以其强大的依赖注入(Dependency Injection, DI)和控制反转(Inversion of Control, IOC)功能而闻名。依赖注入是Spring的核心特性,它允许开发者在运行时通过外部配置来管理对象之间的依赖关系,而不是硬编码这些依赖。这使得代码更加灵活,易于测试和维护。
Spring的模块化设计是其另一个重要特点。主要模块包括:
1. **Core Container**:包含Spring的核心组件,如ApplicationContext和Bean工厂。ApplicationContext提供了一种方式来加载和管理bean,同时提供了事件传播、国际化等功能。
2. **Data Access/Integration**:这部分涵盖了数据库集成,如JDBC抽象层、ORM支持(如Hibernate、JPA),以及对NoSQL数据库的支持。Spring的事务管理也在此部分,提供了声明式和编程式的事务管理方式。
3. **Web**:这部分包括了用于构建Web应用程序的模块,如Spring MVC,它是一个强大的模型-视图-控制器框架,允许开发者创建RESTful服务和处理HTTP请求。
4. **AOP (Aspect-Oriented Programming)**:Spring提供了面向切面编程的支持,可以用来实现如日志、缓存、事务等横切关注点的解耦。
5. **Instrumentation**:这部分主要是为了服务器端应用的部署和监控提供了一些工具和支持,例如类加载器的增强和代理。
Spring Framework 4.0还引入了对Java 8的支持,改进了与WebSocket的集成,提升了性能,并且增强了对现有模块的功能。这份参考文档详细解释了如何使用Spring框架的各个部分,是开发者学习和使用Spring的重要参考资料。
![](https://csdnimg.cn/release/download_crawler_static/7295433/bg10.jpg)
Spring Framework
4.0.4.RELEASE
Spring Framework
Reference Documentation xvi
Document transformation ........................................................................ 534
Summary ....................................................................................................... 534
17.6. Document views (PDF/Excel) .......................................................................... 535
Introduction .................................................................................................... 535
Configuration and setup .................................................................................. 535
Document view definitions ....................................................................... 535
Controller code ....................................................................................... 536
Subclassing for Excel views .................................................................... 536
Subclassing for PDF views ..................................................................... 538
17.7. JasperReports ............................................................................................... 538
Dependencies ................................................................................................ 538
Configuration .................................................................................................. 539
Configuring the ViewResolver .................................................................. 539
Configuring the Views ............................................................................. 539
About Report Files .................................................................................. 539
Using JasperReportsMultiFormatView ...................................................... 540
Populating the ModelAndView ......................................................................... 540
Working with Sub-Reports ............................................................................... 541
Configuring Sub-Report Files .................................................................. 541
Configuring Sub-Report Data Sources ..................................................... 542
Configuring Exporter Parameters ..................................................................... 542
17.8. Feed Views ................................................................................................... 543
17.9. XML Marshalling View .................................................................................... 544
17.10. JSON Mapping View .................................................................................... 544
18. Integrating with other web frameworks ....................................................................... 545
18.1. Introduction .................................................................................................... 545
18.2. Common configuration ................................................................................... 546
18.3. JavaServer Faces 1.2 .................................................................................... 547
SpringBeanFacesELResolver (JSF 1.2+) ......................................................... 547
FacesContextUtils ........................................................................................... 547
18.4. Apache Struts 2.x .......................................................................................... 548
18.5. Tapestry 5.x .................................................................................................. 548
18.6. Further Resources ......................................................................................... 548
19. Portlet MVC Framework ............................................................................................ 549
19.1. Introduction .................................................................................................... 549
Controllers - The C in MVC ............................................................................ 550
Views - The V in MVC .................................................................................... 550
Web-scoped beans ......................................................................................... 550
19.2. The DispatcherPortlet ..................................................................................... 550
19.3. The ViewRendererServlet ............................................................................... 552
19.4. Controllers ..................................................................................................... 553
AbstractController and PortletContentGenerator ............................................... 554
Other simple controllers .................................................................................. 555
Command Controllers ..................................................................................... 555
PortletWrappingController ................................................................................ 556
19.5. Handler mappings .......................................................................................... 556
PortletModeHandlerMapping ............................................................................ 557
ParameterHandlerMapping .............................................................................. 557
PortletModeParameterHandlerMapping ............................................................ 558
Adding HandlerInterceptors ............................................................................. 558
![](https://csdnimg.cn/release/download_crawler_static/7295433/bg11.jpg)
Spring Framework
4.0.4.RELEASE
Spring Framework
Reference Documentation xvii
HandlerInterceptorAdapter ............................................................................... 559
ParameterMappingInterceptor .......................................................................... 559
19.6. Views and resolving them .............................................................................. 559
19.7. Multipart (file upload) support ......................................................................... 560
Using the PortletMultipartResolver ................................................................... 560
Handling a file upload in a form ...................................................................... 561
19.8. Handling exceptions ....................................................................................... 564
19.9. Annotation-based controller configuration ........................................................ 564
Setting up the dispatcher for annotation support ............................................... 564
Defining a controller with @Controller .............................................................. 565
Mapping requests with @RequestMapping ....................................................... 566
Supported handler method arguments ............................................................. 567
Binding request parameters to method parameters with @RequestParam .......... 569
Providing a link to data from the model with @ModelAttribute ............................ 569
Specifying attributes to store in a Session with @SessionAttributes .................... 570
Customizing WebDataBinder initialization ......................................................... 570
Customizing data binding with @InitBinder ............................................... 571
Configuring a custom WebBindingInitializer .............................................. 571
19.10. Portlet application deployment ...................................................................... 571
20. WebSocket Support .................................................................................................. 573
20.1. Introduction .................................................................................................... 573
WebSocket Fallback Options ........................................................................... 573
A Messaging Architecture ............................................................................... 574
Sub-Protocol Support in WebSocket ................................................................ 574
Should I Use WebSocket? .............................................................................. 574
20.2. WebSocket API ............................................................................................. 575
Create and Configure a WebSocketHandler ..................................................... 575
Customizing the WebSocket Handshake .......................................................... 576
WebSocketHandler Decoration ........................................................................ 577
Deployment Considerations ............................................................................. 577
Configuring the WebSocket Engine ................................................................. 579
20.3. SockJS Fallback Options ................................................................................ 581
Overview of SockJS ....................................................................................... 581
Enable SockJS ............................................................................................... 582
HTTP Streaming in IE 8, 9: Ajax/XHR vs IFrame .............................................. 582
Heartbeat Messages ....................................................................................... 584
Servlet 3 Async Requests ............................................................................... 584
CORS Headers for SockJS ............................................................................. 584
20.4. STOMP Over WebSocket Messaging Architecture ........................................... 585
Overview of STOMP ....................................................................................... 585
Enable STOMP over WebSocket ..................................................................... 586
Flow of Messages .......................................................................................... 588
Annotation Message Handling ......................................................................... 589
Sending Messages ......................................................................................... 590
Simple Broker ................................................................................................ 591
Full-Featured Broker ....................................................................................... 591
Connections To Full-Featured Broker .............................................................. 592
Authentication ................................................................................................. 593
User Destinations ........................................................................................... 593
ApplicationContext Events ............................................................................... 594
![](https://csdnimg.cn/release/download_crawler_static/7295433/bg12.jpg)
Spring Framework
4.0.4.RELEASE
Spring Framework
Reference Documentation xviii
Configuration and Performance ....................................................................... 595
Testing Annotated Controller Methods ............................................................. 597
VI. Integration ......................................................................................................................... 598
21. Remoting and web services using Spring ................................................................... 599
21.1. Introduction .................................................................................................... 599
21.2. Exposing services using RMI .......................................................................... 600
Exporting the service using the RmiServiceExporter ......................................... 600
Linking in the service at the client ................................................................... 601
21.3. Using Hessian or Burlap to remotely call services via HTTP .............................. 601
Wiring up the DispatcherServlet for Hessian and co. ......................................... 601
Exposing your beans by using the HessianServiceExporter ............................... 602
Linking in the service on the client .................................................................. 603
Using Burlap .................................................................................................. 603
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ............................................................................................................ 603
21.4. Exposing services using HTTP invokers .......................................................... 604
Exposing the service object ............................................................................ 604
Linking in the service at the client ................................................................... 605
21.5. Web services ................................................................................................. 605
Exposing servlet-based web services using JAX-WS ........................................ 606
Exporting standalone web services using JAX-WS ........................................... 607
Exporting web services using the JAX-WS RI’s Spring support .......................... 607
Accessing web services using JAX-WS ........................................................... 608
21.6. JMS .............................................................................................................. 609
Server-side configuration ................................................................................. 609
Client-side configuration .................................................................................. 610
21.7. AMQP ........................................................................................................... 611
21.8. Auto-detection is not implemented for remote interfaces ................................... 611
21.9. Considerations when choosing a technology .................................................... 611
21.10. Accessing RESTful services on the Client ..................................................... 612
RestTemplate ................................................................................................. 612
Working with the URI .............................................................................. 615
Dealing with request and response headers ............................................. 615
HTTP Message Conversion ............................................................................ 616
StringHttpMessageConverter ................................................................... 616
FormHttpMessageConverter .................................................................... 617
ByteArrayHttpMessageConverter ............................................................. 617
MarshallingHttpMessageConverter ........................................................... 617
MappingJackson2HttpMessageConverter (or
MappingJacksonHttpMessageConverter with Jackson 1.x) ........................ 617
SourceHttpMessageConverter ................................................................. 617
BufferedImageHttpMessageConverter ...................................................... 617
Async RestTemplate ....................................................................................... 617
22. Enterprise JavaBeans (EJB) integration ..................................................................... 619
22.1. Introduction .................................................................................................... 619
22.2. Accessing EJBs ............................................................................................. 619
Concepts ........................................................................................................ 619
Accessing local SLSBs ................................................................................... 619
Accessing remote SLSBs ................................................................................ 621
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ............................................... 621
![](https://csdnimg.cn/release/download_crawler_static/7295433/bg13.jpg)
Spring Framework
4.0.4.RELEASE
Spring Framework
Reference Documentation xix
22.3. Using Spring’s EJB implementation support classes ......................................... 622
EJB 3 injection interceptor .............................................................................. 622
23. JMS (Java Message Service) .................................................................................... 623
23.1. Introduction .................................................................................................... 623
23.2. Using Spring JMS .......................................................................................... 623
JmsTemplate .................................................................................................. 623
Connections ................................................................................................... 624
Caching Messaging Resources ............................................................... 624
SingleConnectionFactory ......................................................................... 624
CachingConnectionFactory ...................................................................... 625
Destination Management ................................................................................. 625
Message Listener Containers .......................................................................... 626
SimpleMessageListenerContainer ............................................................ 626
DefaultMessageListenerContainer ............................................................ 626
Transaction management ................................................................................ 626
23.3. Sending a Message ....................................................................................... 627
Using Message Converters ............................................................................. 628
SessionCallback and ProducerCallback ........................................................... 629
23.4. Receiving a message ..................................................................................... 629
Synchronous Reception .................................................................................. 629
Asynchronous Reception - Message-Driven POJOs .......................................... 629
the SessionAwareMessageListener interface .................................................... 630
the MessageListenerAdapter ........................................................................... 631
Processing messages within transactions ........................................................ 633
23.5. Support for JCA Message Endpoints ............................................................... 633
23.6. JMS Namespace Support ............................................................................... 635
24. JMX ......................................................................................................................... 639
24.1. Introduction .................................................................................................... 639
24.2. Exporting your beans to JMX .......................................................................... 639
Creating an MBeanServer ............................................................................... 641
Reusing an existing MBeanServer ................................................................... 641
Lazy-initialized MBeans ................................................................................... 642
Automatic registration of MBeans .................................................................... 642
Controlling the registration behavior ................................................................. 642
24.3. Controlling the management interface of your beans ........................................ 644
the MBeanInfoAssembler Interface .................................................................. 644
Using Source-Level Metadata (JDK 5.0 annotations) ........................................ 644
Source-Level Metadata Types ......................................................................... 646
the AutodetectCapableMBeanInfoAssembler interface ...................................... 647
Defining management interfaces using Java interfaces ..................................... 648
Using MethodNameBasedMBeanInfoAssembler ............................................... 650
24.4. Controlling the ObjectNames for your beans .................................................... 650
Reading ObjectNames from Properties ............................................................ 650
Using the MetadataNamingStrategy ................................................................. 651
Configuring annotation based MBean export .................................................... 652
24.5. JSR-160 Connectors ...................................................................................... 653
Server-side Connectors ................................................................................... 653
Client-side Connectors .................................................................................... 654
JMX over Burlap/Hessian/SOAP ...................................................................... 654
24.6. Accessing MBeans via Proxies ....................................................................... 654
![](https://csdnimg.cn/release/download_crawler_static/7295433/bg14.jpg)
Spring Framework
4.0.4.RELEASE
Spring Framework
Reference Documentation xx
24.7. Notifications ................................................................................................... 655
Registering Listeners for Notifications .............................................................. 655
Publishing Notifications ................................................................................... 659
24.8. Further Resources ......................................................................................... 661
25. JCA CCI .................................................................................................................. 662
25.1. Introduction .................................................................................................... 662
25.2. Configuring CCI ............................................................................................. 662
Connector configuration .................................................................................. 662
ConnectionFactory configuration in Spring ....................................................... 663
Configuring CCI connections ........................................................................... 663
Using a single CCI connection ........................................................................ 664
25.3. Using Spring’s CCI access support ................................................................. 665
Record conversion .......................................................................................... 665
the CciTemplate ............................................................................................. 666
DAO support .................................................................................................. 667
Automatic output record generation ................................................................. 668
Summary ....................................................................................................... 668
Using a CCI Connection and Interaction directly ............................................... 669
Example for CciTemplate usage ...................................................................... 670
25.4. Modeling CCI access as operation objects ...................................................... 672
MappingRecordOperation ................................................................................ 672
MappingCommAreaOperation .......................................................................... 673
Automatic output record generation ................................................................. 674
Summary ....................................................................................................... 674
Example for MappingRecordOperation usage ................................................... 674
Example for MappingCommAreaOperation usage ............................................. 676
25.5. Transactions .................................................................................................. 678
26. Email ....................................................................................................................... 680
26.1. Introduction .................................................................................................... 680
26.2. Usage ........................................................................................................... 680
Basic MailSender and SimpleMailMessage usage ............................................ 681
Using the JavaMailSender and the MimeMessagePreparator ............................. 682
26.3. Using the JavaMail MimeMessageHelper ........................................................ 683
Sending attachments and inline resources ....................................................... 683
Attachments ........................................................................................... 683
Inline resources ...................................................................................... 684
Creating email content using a templating library .............................................. 684
A Velocity-based example ....................................................................... 684
27. Task Execution and Scheduling ................................................................................. 688
27.1. Introduction .................................................................................................... 688
27.2. The Spring TaskExecutor abstraction .............................................................. 688
TaskExecutor types ........................................................................................ 688
Using a TaskExecutor ..................................................................................... 689
27.3. The Spring TaskScheduler abstraction ............................................................ 690
the Trigger interface ....................................................................................... 691
Trigger implementations .................................................................................. 691
TaskScheduler implementations ...................................................................... 692
27.4. Annotation Support for Scheduling and Asynchronous Execution ....................... 692
Enable scheduling annotations ........................................................................ 692
The @Scheduled Annotation ........................................................................... 693
剩余838页未读,继续阅读
214 浏览量
112 浏览量
133 浏览量
147 浏览量
No qualifying bean of type 'com.xxx' available: expected at least 1 bean which qualifies as autowire
300 浏览量
128 浏览量
134 浏览量
2014-10-31 上传
145 浏览量
![](https://profile-avatar.csdnimg.cn/95782f9ab28242af876588b14351bfca_traynor.jpg!1)
FarDawn
- 粉丝: 0
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- MATLAB实现离散分数实体计算绘图详解
- 熊海日志系统v1.4.1发布:适用于微博日记博客管理
- 挑战UI布局:AutoLayout在UIKit中的实践指南
- C#.NET开发TAPI 3.0应用程序教程
- 深入探讨Oberon-0语言特性与编译原理实验三
- 华为云售前认证培训课程详解
- 深度学习交通标志分类器的构建与应用
- MATLAB实现函数最小值的遗传算法求解
- Python Django Web开发实战源码解析
- 探索WebView组件的使用技巧与示例应用
- 探索Java领域的Me2U_cmd-f项目创新
- jQuery历史事件时间轴插件使用教程与示例
- Matlab实现NSGA2遗传算法编程实例
- 聚类与抛物线逼近:matlab中的全局优化新技术
- 绿色免安装版驱动精灵:全面更新与细节优化
- DIY名片二维码:轻松储存到手机的解决方案
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)