没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring 3.1.3 技术文档:核心依赖与集成指南
Spring 3.1.3 技术文档:核心依赖与集成指南
需积分: 8 0 下载量 94 浏览量
更新于2024-07-23
收藏 4.2MB PDF 举报
"Spring3.1.3技术文档,全英文,详细介绍了Spring3.1.3版本的核心概念和使用方法。"
Spring框架是Java开发中广泛应用的一个开源框架,Spring3.1.3是该框架的一个具体版本。本技术文档深入探讨了Spring的核心特性,包括依赖注入(Dependency Injection, DI)和控制反转(Inversion of Control, IoC)。这两个概念是Spring框架的基础,它们使得开发者可以更灵活地管理对象之间的关系,降低组件间的耦合度。
文档详细划分了Spring的各个模块:
1. Core Container:这是Spring框架的核心,包含Bean工厂(BeanFactory)和应用上下文(ApplicationContext),它们负责管理应用对象的生命周期和依赖关系。此外,还包括核心接口如BeanDefinition和BeanPostProcessor等。
2. Data Access/Integration:这部分提供了对数据库访问的支持,如JDBC抽象、ORM(Object-Relational Mapping)集成,包括Hibernate、JPA等,以及事务管理功能。
3. Web:Spring的Web模块包括了Spring MVC,这是一个强大的模型-视图-控制器框架,用于构建Web应用程序。它提供了一种灵活的方式来组织和处理HTTP请求。
4. AOP and Instrumentation:面向切面编程(Aspect-Oriented Programming, AOP)模块允许开发者定义“切面”,这些切面可以跨越多个对象来封装关注点,如日志、事务管理等。Instrumentation则提供了类加载器和代理相关的工具。
5. Test:Spring测试模块支持单元测试和集成测试,提供了测试上下文框架,方便在测试环境中配置和管理应用对象。
文档还涵盖了Spring的使用场景,包括如何通过依赖管理(Dependency Management)来规范库的版本,以及如何遵循命名约定。对于依赖管理,文档分别讨论了Maven和Ivy两种构建工具的配置方法。此外,文档还涉及了日志配置,这对于调试和监控应用状态至关重要。
Spring3.1.3技术文档是一份详尽的参考资料,无论你是初学者还是经验丰富的开发者,都能从中获得关于Spring框架的深入理解。通过学习这份文档,你将能够有效地利用Spring进行组件设计、数据访问、Web开发、面向切面编程以及测试。
16.11. Handling exceptions ...................................................................................485
HandlerExceptionResolver ............................................................................485
@ExceptionHandler ......................................................................................486
16.12. Convention over configuration support ........................................................487
The Controller ControllerClassNameHandlerMapping ....................................487
The Model ModelMap (ModelAndView) .......................................................488
The View - RequestToViewNameTranslator ..................................................490
16.13. ETag support ..............................................................................................491
16.14. Configuring Spring MVC ............................................................................492
Enabling MVC Java Config or the MVC XML Namespace .............................492
Customizing the Provided Configuration ........................................................493
Configuring Interceptors ...............................................................................494
Configuring View Controllers .......................................................................495
Configuring Serving of Resources .................................................................495
mvc:default-servlet-handler ...........................................................................497
More Spring Web MVC Resources ................................................................498
Advanced Customizations with MVC Java Config ..........................................499
Advanced Customizations with the MVC Namespace .....................................499
17. View technologies ...................................................................................................501
17.1. Introduction .................................................................................................501
17.2. JSP & JSTL .................................................................................................501
View resolvers .............................................................................................501
'Plain-old' JSPs versus JSTL ..........................................................................502
Additional tags facilitating development ........................................................502
Using Spring's form tag library ......................................................................502
Configuration .......................................................................................502
The form tag ........................................................................................503
The input tag ........................................................................................504
The checkbox tag ..................................................................................504
The checkboxes tag ..............................................................................506
The radiobutton tag ...............................................................................506
The radiobuttons tag .............................................................................507
The password tag ..................................................................................507
The select tag .......................................................................................507
The option tag ......................................................................................508
The options tag .....................................................................................508
The textarea tag ....................................................................................509
The hidden tag ......................................................................................509
The errors tag .......................................................................................510
HTTP Method Conversion ....................................................................512
HTML5 Tags .......................................................................................512
17.3. Tiles ............................................................................................................513
Dependencies ...............................................................................................513
How to integrate Tiles ...................................................................................513
UrlBasedViewResolver .........................................................................514
Spring Framework
3.1 Reference Documentation xvi
ResourceBundleViewResolver ..............................................................514
SimpleSpringPreparerFactory and SpringBeanPreparerFactory ................514
17.4. Velocity & FreeMarker .................................................................................515
Dependencies ...............................................................................................515
Context configuration ...................................................................................515
Creating templates ........................................................................................516
Advanced configuration ................................................................................516
velocity.properties ................................................................................517
FreeMarker ..........................................................................................517
Bind support and form handling .....................................................................517
The bind macros ...................................................................................518
Simple binding .....................................................................................518
Form input generation macros ...............................................................519
HTML escaping and XHTML compliance .............................................523
17.5. XSLT ..........................................................................................................524
My First Words ............................................................................................524
Bean definitions ...................................................................................524
Standard MVC controller code ..............................................................524
Convert the model data to XML ............................................................525
Defining the view properties ..................................................................526
Document transformation ......................................................................526
Summary .....................................................................................................526
17.6. Document views (PDF/Excel) .......................................................................527
Introduction .................................................................................................527
Configuration and setup ................................................................................527
Document view definitions ....................................................................527
Controller code .....................................................................................528
Subclassing for Excel views ..................................................................528
Subclassing for PDF views ....................................................................529
17.7. JasperReports ...............................................................................................530
Dependencies ...............................................................................................530
Configuration ...............................................................................................530
Configuring the ViewResolver ..............................................................531
Configuring the Views ..........................................................................531
About Report Files ...............................................................................531
Using JasperReportsMultiFormatView ...................................................532
Populating the ModelAndView ......................................................................533
Working with Sub-Reports ............................................................................533
Configuring Sub-Report Files ................................................................534
Configuring Sub-Report Data Sources ...................................................534
Configuring Exporter Parameters ...................................................................535
17.8. Feed Views ..................................................................................................535
17.9. XML Marshalling View ................................................................................536
17.10. JSON Mapping View ..................................................................................536
18. Integrating with other web frameworks .....................................................................538
Spring Framework
3.1 Reference Documentation xvii
18.1. Introduction .................................................................................................538
18.2. Common configuration .................................................................................539
18.3. JavaServer Faces 1.1 and 1.2 .........................................................................540
DelegatingVariableResolver (JSF 1.1/1.2) ......................................................540
SpringBeanVariableResolver (JSF 1.1/1.2) .....................................................541
SpringBeanFacesELResolver (JSF 1.2+) ........................................................541
FacesContextUtils ........................................................................................542
18.4. Apache Struts 1.x and 2.x .............................................................................542
ContextLoaderPlugin ....................................................................................543
DelegatingRequestProcessor .................................................................544
DelegatingActionProxy .........................................................................544
ActionSupport Classes ..................................................................................545
18.5. WebWork 2.x ...............................................................................................545
18.6. Tapestry 3.x and 4.x .....................................................................................546
Injecting Spring-managed beans ....................................................................547
Dependency Injecting Spring Beans into Tapestry pages .........................548
Component definition files ....................................................................549
Adding abstract accessors ......................................................................550
Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x style
.............................................................................................................552
18.7. Further Resources .........................................................................................553
19. Portlet MVC Framework .........................................................................................554
19.1. Introduction .................................................................................................554
Controllers - The C in MVC ..........................................................................555
Views - The V in MVC .................................................................................555
Web-scoped beans ........................................................................................556
19.2. The DispatcherPortlet ...................................................................................556
19.3. The ViewRendererServlet .............................................................................558
19.4. Controllers ...................................................................................................559
AbstractController and PortletContentGenerator .............................................559
Other simple controllers ................................................................................561
Command Controllers ...................................................................................561
PortletWrappingController ............................................................................562
19.5. Handler mappings ........................................................................................562
PortletModeHandlerMapping ........................................................................563
ParameterHandlerMapping ............................................................................564
PortletModeParameterHandlerMapping .........................................................564
Adding HandlerInterceptors ..........................................................................565
HandlerInterceptorAdapter ............................................................................565
ParameterMappingInterceptor .......................................................................565
19.6. Views and resolving them .............................................................................566
19.7. Multipart (file upload) support ......................................................................566
Using the PortletMultipartResolver ................................................................567
Handling a file upload in a form ....................................................................567
19.8. Handling exceptions .....................................................................................570
Spring Framework
3.1 Reference Documentation xviii
19.9. Annotation-based controller configuration .....................................................571
Setting up the dispatcher for annotation support ..............................................571
Defining a controller with @Controller ..........................................................571
Mapping requests with @RequestMapping .....................................................572
Supported handler method arguments ............................................................573
Binding request parameters to method parameters with @RequestParam ..........575
Providing a link to data from the model with @ModelAttribute .......................576
Specifying attributes to store in a Session with @SessionAttributes .................576
Customizing WebDataBinder initialization .....................................................577
Customizing data binding with @InitBinder ...........................................577
Configuring a custom WebBindingInitializer ..........................................577
19.10. Portlet application deployment ....................................................................578
VI. Integration ......................................................................................................................579
20. Remoting and web services using Spring ..................................................................580
20.1. Introduction .................................................................................................580
20.2. Exposing services using RMI ........................................................................581
Exporting the service using the RmiServiceExporter .......................................581
Linking in the service at the client .................................................................582
20.3. Using Hessian or Burlap to remotely call services via HTTP ...........................583
Wiring up the DispatcherServlet for Hessian and co. .......................................583
Exposing your beans by using the HessianServiceExporter ..............................583
Linking in the service on the client ................................................................584
Using Burlap ................................................................................................584
Applying HTTP basic authentication to a service exposed through Hessian or
Burlap ..........................................................................................................585
20.4. Exposing services using HTTP invokers ........................................................585
Exposing the service object ...........................................................................585
Linking in the service at the client .................................................................586
20.5. Web services ................................................................................................587
Exposing servlet-based web services using JAX-RPC .....................................588
Accessing web services using JAX-RPC ........................................................588
Registering JAX-RPC Bean Mappings ...........................................................590
Registering your own JAX-RPC Handler .......................................................591
Exposing servlet-based web services using JAX-WS ......................................591
Exporting standalone web services using JAX-WS .........................................592
Exporting web services using the JAX-WS RI's Spring support .......................593
Accessing web services using JAX-WS ..........................................................593
20.6. JMS .............................................................................................................594
Server-side configuration ..............................................................................595
Client-side configuration ...............................................................................596
20.7. Auto-detection is not implemented for remote interfaces .................................597
20.8. Considerations when choosing a technology ...................................................597
20.9. Accessing RESTful services on the Client ......................................................598
RestTemplate ...............................................................................................598
Working with the URI ..........................................................................600
Spring Framework
3.1 Reference Documentation xix
Dealing with request and response headers .............................................601
HTTP Message Conversion ...........................................................................601
StringHttpMessageConverter .................................................................602
FormHttpMessageConverter ..................................................................602
ByteArrayHttpMessageConverter ..........................................................602
MarshallingHttpMessageConverter ........................................................602
MappingJacksonHttpMessageConverter .................................................603
SourceHttpMessageConverter ...............................................................603
BufferedImageHttpMessageConverter ...................................................603
21. Enterprise JavaBeans (EJB) integration ....................................................................604
21.1. Introduction .................................................................................................604
21.2. Accessing EJBs ............................................................................................604
Concepts ......................................................................................................604
Accessing local SLSBs .................................................................................605
Accessing remote SLSBs ..............................................................................606
Accessing EJB 2.x SLSBs versus EJB 3 SLSBs ..............................................607
21.3. Using Spring's EJB implementation support classes ........................................607
EJB 2.x base classes .....................................................................................607
EJB 3 injection interceptor ............................................................................609
22. JMS (Java Message Service) ....................................................................................611
22.1. Introduction .................................................................................................611
22.2. Using Spring JMS ........................................................................................611
JmsTemplate ................................................................................................611
Connections .................................................................................................612
Caching Messaging Resources ...............................................................613
SingleConnectionFactory ......................................................................613
CachingConnectionFactory ...................................................................613
Destination Management ...............................................................................613
Message Listener Containers .........................................................................614
SimpleMessageListenerContainer ..........................................................615
DefaultMessageListenerContainer .........................................................615
Transaction management ...............................................................................615
22.3. Sending a Message .......................................................................................616
Using Message Converters ............................................................................617
SessionCallback and ProducerCallback ..........................................................618
22.4. Receiving a message .....................................................................................618
Synchronous Reception .................................................................................618
Asynchronous Reception - Message-Driven POJOs ........................................618
The SessionAwareMessageListener interface .................................................619
The MessageListenerAdapter ........................................................................619
Processing messages within transactions ........................................................621
22.5. Support for JCA Message Endpoints ..............................................................622
22.6. JMS Namespace Support ..............................................................................624
23. JMX .......................................................................................................................629
23.1. Introduction .................................................................................................629
Spring Framework
3.1 Reference Documentation xx
剩余847页未读,继续阅读
点击了解资源详情
113 浏览量
1572 浏览量
2012-11-18 上传
2013-01-05 上传
2010-05-17 上传
2024-06-28 上传
654 浏览量
2012-11-20 上传
haozhacheng
- 粉丝: 0
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Gdal 2.2.2 for .Net And .NetCore
- 微生物肥料项目计划书.zip
- mhygepdf:多元超几何概率密度函数。-matlab开发
- 寄存器查看工具,十六进制,十进制显示二进制值
- EchartConvert:图表生成
- gestionStudent
- Typersion:最好的打字练习游戏! 在免费游戏和冒险模式之间进行选择,后者是一种rpg式的砍杀模式,目标是达到第100阶段! 每五个阶段都会受到迷你小老板的挑战,在您面对越来越强的敌人时提高打字速度!
- 联体别墅设计施工图
- CUDA MEX:在 MATLAB 中编译 CUDA! 只需编写 cuda_mex filename.cu 就可以了。-matlab开发
- redisclient-win32.x86.2.0.rar
- PRNICT:硬件
- Platzi徽章
- MySQL-python-1.2.5-cp27-none-win-amd64.whl的zip安装包
- 两款css+html打造的超炫酷的网站在线客服代码,鼠标划过可以弹出在线客服窗口
- SDL2 i.MX6ULL移植包
- 基于vue2.0实现的滑动进度条
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功