没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring框架参考手册:依赖注入与全面指南
《Spring框架参考手册》是一本详细介绍了Spring框架的权威文档,由多位知名开发者罗杰·约翰逊(Rod Johnson)、尤尔根·霍尔勒(Juergen Hoeller)等人合作编写,版权日期涵盖2004年至2011年。该电子书提供了全面的Spring框架介绍,包括但不限于以下几个核心主题:
1. **Spring框架概述**:首先,读者将对Spring框架的整体概念有深入理解,涉及依赖注入( Dependency Injection, DI) 和控制反转(Inversion of Control, IoC)的设计理念,这是Spring架构的基础。
2. **模块划分**:Spring框架被划分为多个模块,如核心容器(Core Container)、数据访问/集成(Data Access/Integration)、Web应用开发、面向切面编程(AOP, Aspect-Oriented Programming)和性能监控与插桩(Instrumentation)等,这有助于开发者根据项目需求选择相应的组件。
3. **核心功能**:文档详细阐述了如何构建和管理应用程序的生命周期,以及如何通过Spring容器来管理对象的创建和依赖关系。此外,它还涵盖了Spring在测试驱动开发(Test-Driven Development, TDD)中的应用。
4. **依赖管理和命名约定**:文档强调了Spring框架中的依赖管理策略,包括Spring自身的依赖管理以及与Maven和Ivy等构建工具的集成,帮助开发者更好地组织和管理项目的依赖。
5. **Spring与第三方库的关系**:书中讨论了如何在Spring项目中引用其他库,以及如何确保依赖版本的一致性,这对于协作开发和维护至关重要。
6. **日志管理**:Spring提供了一套标准的日志处理机制,使得在不同环境中配置和使用日志记录变得更加方便。
每一章都包含了丰富的示例代码和实用的指导,旨在帮助读者逐步掌握Spring框架的使用,无论是初学者还是经验丰富的开发人员都能从中受益匪浅。整体来说,《Spring框架参考手册》是深入学习和实践Spring技术的必备参考资料。
HandlerExceptionResolver ............................................................................484
@ExceptionHandler ......................................................................................485
16.12. Convention over configuration support ........................................................486
The Controller ControllerClassNameHandlerMapping ....................................486
The Model ModelMap (ModelAndView) .......................................................487
The View - RequestToViewNameTranslator ..................................................488
16.13. ETag support ..............................................................................................490
16.14. Configuring Spring MVC ............................................................................490
Enabling MVC Java Config or the MVC XML Namespace .............................491
Customizing the Provided Configuration ........................................................492
Configuring Interceptors ...............................................................................493
Configuring View Controllers .......................................................................494
Configuring Serving of Resources .................................................................494
mvc:default-servlet-handler ...........................................................................496
More Spring Web MVC Resources ................................................................497
Advanced Customizations with MVC Java Config ..........................................498
Advanced Customizations with the MVC Namespace .....................................498
17. View technologies ...................................................................................................500
17.1. Introduction .................................................................................................500
17.2. JSP & JSTL .................................................................................................500
View resolvers .............................................................................................500
'Plain-old' JSPs versus JSTL ..........................................................................501
Additional tags facilitating development ........................................................501
Using Spring's form tag library ......................................................................501
Configuration .......................................................................................501
The form tag ........................................................................................502
The input tag ........................................................................................503
The checkbox tag ..................................................................................503
The checkboxes tag ..............................................................................505
The radiobutton tag ...............................................................................505
The radiobuttons tag .............................................................................506
The password tag ..................................................................................506
The select tag .......................................................................................506
The option tag ......................................................................................507
The options tag .....................................................................................507
The textarea tag ....................................................................................508
The hidden tag ......................................................................................508
The errors tag .......................................................................................509
HTTP Method Conversion ....................................................................511
HTML5 Tags .......................................................................................511
17.3. Tiles ............................................................................................................512
Dependencies ...............................................................................................512
How to integrate Tiles ...................................................................................512
UrlBasedViewResolver .........................................................................513
ResourceBundleViewResolver ..............................................................513
Spring Framework
3.1 Reference Documentation xvi
SimpleSpringPreparerFactory and SpringBeanPreparerFactory ................513
17.4. Velocity & FreeMarker .................................................................................514
Dependencies ...............................................................................................514
Context configuration ...................................................................................514
Creating templates ........................................................................................515
Advanced configuration ................................................................................515
velocity.properties ................................................................................515
FreeMarker ..........................................................................................516
Bind support and form handling .....................................................................516
The bind macros ...................................................................................517
Simple binding .....................................................................................517
Form input generation macros ...............................................................518
HTML escaping and XHTML compliance .............................................522
17.5. XSLT ..........................................................................................................523
My First Words ............................................................................................523
Bean definitions ...................................................................................523
Standard MVC controller code ..............................................................523
Convert the model data to XML ............................................................524
Defining the view properties ..................................................................525
Document transformation ......................................................................525
Summary .....................................................................................................525
17.6. Document views (PDF/Excel) .......................................................................526
Introduction .................................................................................................526
Configuration and setup ................................................................................526
Document view definitions ....................................................................526
Controller code .....................................................................................527
Subclassing for Excel views ..................................................................527
Subclassing for PDF views ....................................................................528
17.7. JasperReports ...............................................................................................529
Dependencies ...............................................................................................529
Configuration ...............................................................................................529
Configuring the ViewResolver ..............................................................529
Configuring the Views ..........................................................................530
About Report Files ...............................................................................530
Using JasperReportsMultiFormatView ...................................................531
Populating the ModelAndView ......................................................................532
Working with Sub-Reports ............................................................................532
Configuring Sub-Report Files ................................................................533
Configuring Sub-Report Data Sources ...................................................533
Configuring Exporter Parameters ...................................................................534
17.8. Feed Views ..................................................................................................534
17.9. XML Marshalling View ................................................................................535
17.10. JSON Mapping View ..................................................................................535
18. Integrating with other web frameworks .....................................................................536
18.1. Introduction .................................................................................................536
Spring Framework
3.1 Reference Documentation xvii
18.2. Common configuration .................................................................................537
18.3. JavaServer Faces 1.1 and 1.2 .........................................................................538
DelegatingVariableResolver (JSF 1.1/1.2) ......................................................538
SpringBeanVariableResolver (JSF 1.1/1.2) .....................................................539
SpringBeanFacesELResolver (JSF 1.2+) ........................................................539
FacesContextUtils ........................................................................................540
18.4. Apache Struts 1.x and 2.x .............................................................................540
ContextLoaderPlugin ....................................................................................541
DelegatingRequestProcessor .................................................................542
DelegatingActionProxy .........................................................................542
ActionSupport Classes ..................................................................................543
18.5. WebWork 2.x ...............................................................................................543
18.6. Tapestry 3.x and 4.x .....................................................................................544
Injecting Spring-managed beans ....................................................................545
Dependency Injecting Spring Beans into Tapestry pages .........................546
Component definition files ....................................................................547
Adding abstract accessors ......................................................................548
Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x style
.............................................................................................................550
18.7. Further Resources .........................................................................................551
19. Portlet MVC Framework .........................................................................................552
19.1. Introduction .................................................................................................552
Controllers - The C in MVC ..........................................................................553
Views - The V in MVC .................................................................................553
Web-scoped beans ........................................................................................554
19.2. The DispatcherPortlet ...................................................................................554
19.3. The ViewRendererServlet .............................................................................556
19.4. Controllers ...................................................................................................557
AbstractController and PortletContentGenerator .............................................557
Other simple controllers ................................................................................559
Command Controllers ...................................................................................559
PortletWrappingController ............................................................................560
19.5. Handler mappings ........................................................................................560
PortletModeHandlerMapping ........................................................................561
ParameterHandlerMapping ............................................................................562
PortletModeParameterHandlerMapping .........................................................562
Adding HandlerInterceptors ..........................................................................563
HandlerInterceptorAdapter ............................................................................563
ParameterMappingInterceptor .......................................................................563
19.6. Views and resolving them .............................................................................564
19.7. Multipart (file upload) support ......................................................................564
Using the PortletMultipartResolver ................................................................565
Handling a file upload in a form ....................................................................565
19.8. Handling exceptions .....................................................................................568
19.9. Annotation-based controller configuration .....................................................569
Spring Framework
3.1 Reference Documentation xviii
Setting up the dispatcher for annotation support ..............................................569
Defining a controller with @Controller ..........................................................569
Mapping requests with @RequestMapping .....................................................570
Supported handler method arguments ............................................................571
Binding request parameters to method parameters with @RequestParam ..........573
Providing a link to data from the model with @ModelAttribute .......................574
Specifying attributes to store in a Session with @SessionAttributes .................574
Customizing WebDataBinder initialization .....................................................575
Customizing data binding with @InitBinder ...........................................575
Configuring a custom WebBindingInitializer ..........................................575
19.10. Portlet application deployment ....................................................................576
VI. Integration ......................................................................................................................577
20. Remoting and web services using Spring ..................................................................578
20.1. Introduction .................................................................................................578
20.2. Exposing services using RMI ........................................................................579
Exporting the service using the RmiServiceExporter .......................................579
Linking in the service at the client .................................................................580
20.3. Using Hessian or Burlap to remotely call services via HTTP ...........................581
Wiring up the DispatcherServlet for Hessian and co. .......................................581
Exposing your beans by using the HessianServiceExporter ..............................581
Linking in the service on the client ................................................................582
Using Burlap ................................................................................................582
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ..........................................................................................................583
20.4. Exposing services using HTTP invokers ........................................................583
Exposing the service object ...........................................................................583
Linking in the service at the client .................................................................584
20.5. Web services ................................................................................................585
Exposing servlet-based web services using JAX-RPC .....................................586
Accessing web services using JAX-RPC ........................................................586
Registering JAX-RPC Bean Mappings ...........................................................588
Registering your own JAX-RPC Handler .......................................................589
Exposing servlet-based web services using JAX-WS ......................................589
Exporting standalone web services using JAX-WS .........................................590
Exporting web services using the JAX-WS RI's Spring support .......................591
Accessing web services using JAX-WS ..........................................................591
20.6. JMS .............................................................................................................592
Server-side configuration ..............................................................................593
Client-side configuration ...............................................................................594
20.7. Auto-detection is not implemented for remote interfaces .................................595
20.8. Considerations when choosing a technology ...................................................595
20.9. Accessing RESTful services on the Client ......................................................596
RestTemplate ...............................................................................................596
Working with the URI ..........................................................................598
Dealing with request and response headers .............................................599
Spring Framework
3.1 Reference Documentation xix
HTTP Message Conversion ...........................................................................599
StringHttpMessageConverter .................................................................600
FormHttpMessageConverter ..................................................................600
ByteArrayMessageConverter .................................................................600
MarshallingHttpMessageConverter ........................................................600
MappingJacksonHttpMessageConverter .................................................601
SourceHttpMessageConverter ...............................................................601
BufferedImageHttpMessageConverter ...................................................601
21. Enterprise JavaBeans (EJB) integration ....................................................................602
21.1. Introduction .................................................................................................602
21.2. Accessing EJBs ............................................................................................602
Concepts ......................................................................................................602
Accessing local SLSBs .................................................................................603
Accessing remote SLSBs ..............................................................................604
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ..............................................605
21.3. Using Spring's EJB implementation support classes ........................................605
EJB 2.x base classes .....................................................................................605
EJB 3 injection interceptor ............................................................................607
22. JMS (Java Message Service) ....................................................................................609
22.1. Introduction .................................................................................................609
22.2. Using Spring JMS ........................................................................................609
JmsTemplate ................................................................................................609
Connections .................................................................................................610
Caching Messaging Resources ...............................................................611
SingleConnectionFactory ......................................................................611
CachingConnectionFactory ...................................................................611
Destination Management ...............................................................................611
Message Listener Containers .........................................................................612
SimpleMessageListenerContainer ..........................................................613
DefaultMessageListenerContainer .........................................................613
Transaction management ...............................................................................613
22.3. Sending a Message .......................................................................................614
Using Message Converters ............................................................................615
SessionCallback and ProducerCallback ..........................................................616
22.4. Receiving a message .....................................................................................616
Synchronous Reception .................................................................................616
Asynchronous Reception - Message-Driven POJOs ........................................616
The SessionAwareMessageListener interface .................................................617
The MessageListenerAdapter ........................................................................617
Processing messages within transactions ........................................................619
22.5. Support for JCA Message Endpoints ..............................................................620
22.6. JMS Namespace Support ..............................................................................622
23. JMX .......................................................................................................................627
23.1. Introduction .................................................................................................627
23.2. Exporting your beans to JMX ........................................................................627
Spring Framework
3.1 Reference Documentation xx
剩余845页未读,继续阅读
2010-11-18 上传
2008-11-07 上传
2008-06-11 上传
2023-08-25 上传
2013-07-22 上传
2013-06-05 上传
西门大扫雪
- 粉丝: 21
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功