没有合适的资源?快使用搜索试试~ 我知道了~
首页Spring框架4.3.2参考指南:核心、AOP、DAO、ORM、Web及MVC
"Spring4.3.2参考文档(英文)"
Spring框架是Java开发中广泛使用的轻量级框架,它提供了多种核心功能和模块来帮助开发者构建高效、可维护的软件应用。以下是对标题和描述中提及的知识点的详细解释:
1. **核心容器(Core Container)**
- **BeanFactory**:这是Spring框架的基础,它实现了工厂模式,负责创建、管理和维护应用中的对象。BeanFactory使用控制反转(IOC)来解耦应用的配置和业务逻辑,使得对象之间的依赖关系由容器负责管理。
2. **Spring上下文(Spring Context)**
- **应用程序上下文**:Spring Context作为核心容器的扩展,它提供了一个容器,用于存储和管理Bean,同时包含企业服务如JNDI、EJB、电子邮件、国际化、校验和调度等功能。它可以看作是一个全局的服务提供者。
3. **Spring AOP(面向切面编程)**
- **AOP集成**:Spring AOP模块允许开发者在不改变原有代码的情况下,添加横切关注点,如日志、事务管理等。这使得事务管理等服务可以被声明式地应用于任何Spring管理的对象,无需直接依赖EJB组件。
4. **Spring DAO(JDBC数据访问对象)**
- **DAO抽象层**:Spring提供了针对JDBC的DAO抽象层,它提供了一套统一的异常处理机制,简化了数据库操作中的异常处理,同时也减少了与数据库供应商相关的错误处理代码。
5. **Spring ORM(对象关系映射)**
- **ORM集成**:Spring支持多种ORM框架(如JDO、Hibernate、iBatis SQL Map),提供了通用的事务管理和DAO异常层次结构,使得开发者可以方便地将ORM框架集成到Spring应用中。
6. **Spring Web模块**
- **Web上下文**:此模块建立在应用程序上下文之上,专为Web应用程序设计,支持与Jakarta Struts等Web框架的集成,简化了多部分请求处理和请求参数绑定。
7. **Spring MVC框架**
- **Model-View-Controller**:Spring MVC是Spring提供的一个全面的MVC实现,具有高度可配置性,支持多种视图技术如JSP、Velocity、Tiles等。通过策略接口,MVC框架可以容纳各种视图技术,并简化了Web应用的开发。
8. **JMS(Java消息服务)**
- **消息传递**:虽然在描述中没有直接提及,但标签中包含了JMS,这表明Spring支持JMS,可以用来实现异步通信和解耦应用组件,提供可靠的消息传递服务。
Spring框架的设计理念是模块化,这使得开发者可以根据需求选择使用哪些模块,避免引入不必要的复杂性。其强大的功能和灵活性使得它成为了Java开发中的首选框架之一。通过阅读Spring4.3.2的参考文档,开发者可以深入了解每个模块的功能,更好地利用Spring来构建复杂的企业级应用。
Spring Framework Reference Documentation
4.3.2.RELEASE Spring Framework xvi
21.6. Castor ........................................................................................................... 467
CastorMarshaller ............................................................................................ 467
Mapping ......................................................................................................... 468
XML Schema-based Configuration ........................................................... 468
21.7. XMLBeans ..................................................................................................... 469
XmlBeansMarshaller ....................................................................................... 469
XML Schema-based Configuration ........................................................... 469
21.8. JiBX .............................................................................................................. 469
JibxMarshaller ................................................................................................ 470
XML Schema-based Configuration ........................................................... 470
21.9. XStream ........................................................................................................ 470
XStreamMarshaller ......................................................................................... 470
VI. The Web .......................................................................................................................... 472
22. Web MVC framework ................................................................................................ 473
22.1. Introduction to Spring Web MVC framework .................................................... 473
Features of Spring Web MVC ......................................................................... 473
Pluggability of other MVC implementations ...................................................... 475
22.2. The DispatcherServlet .................................................................................... 475
Special Bean Types In the WebApplicationContext ........................................... 479
Default DispatcherServlet Configuration ........................................................... 480
DispatcherServlet Processing Sequence .......................................................... 480
22.3. Implementing Controllers ................................................................................ 482
Defining a controller with @Controller .............................................................. 482
Mapping Requests With @RequestMapping ..................................................... 483
Composed @RequestMapping Variants ................................................... 484
@Controller and AOP Proxying ............................................................... 485
New Support Classes for @RequestMapping methods in Spring MVC 3.1 .. 485
URI Template Patterns ........................................................................... 486
URI Template Patterns with Regular Expressions ..................................... 487
Path Patterns ......................................................................................... 487
Path Pattern Comparison ........................................................................ 488
Path Patterns with Placeholders .............................................................. 488
Suffix Pattern Matching ........................................................................... 488
Suffix Pattern Matching and RFD ............................................................ 488
Matrix Variables ...................................................................................... 489
Consumable Media Types ....................................................................... 491
Producible Media Types .......................................................................... 491
Request Parameters and Header Values ................................................. 492
HTTP HEAD and HTTP OPTIONS .......................................................... 492
Defining @RequestMapping handler methods .................................................. 493
Supported method argument types .......................................................... 493
Supported method return types ............................................................... 495
Binding request parameters to method parameters with @RequestParam ... 496
Mapping the request body with the @RequestBody annotation .................. 497
Mapping the response body with the @ResponseBody annotation ............. 498
Creating REST Controllers with the @RestController annotation ................ 499
Using HttpEntity ...................................................................................... 499
Using @ModelAttribute on a method ....................................................... 499
Using @ModelAttribute on a method argument ......................................... 500
Spring Framework Reference Documentation
4.3.2.RELEASE Spring Framework xvii
Using @SessionAttributes to store model attributes in the HTTP session
between requests ................................................................................... 502
Using @SessionAttribute to access pre-existing global session attributes .... 503
Using @RequestAttribute to access request attributes .............................. 503
Working with "application/x-www-form-urlencoded" data ............................ 503
Mapping cookie values with the @CookieValue annotation ........................ 504
Mapping request header attributes with the @RequestHeader annotation ... 504
Method Parameters And Type Conversion ............................................... 505
Customizing WebDataBinder initialization ................................................. 505
Advising controllers with @ControllerAdvice and @RestControllerAdvice .... 506
Jackson Serialization View Support ......................................................... 507
Jackson JSONP Support ........................................................................ 508
Asynchronous Request Processing .................................................................. 509
Exception Handling for Async Requests ................................................... 510
Intercepting Async Requests ................................................................... 511
HTTP Streaming ..................................................................................... 511
HTTP Streaming With Server-Sent Events ............................................... 511
HTTP Streaming Directly To The OutputStream ....................................... 512
Configuring Asynchronous Request Processing ........................................ 512
Testing Controllers ......................................................................................... 513
22.4. Handler mappings .......................................................................................... 513
Intercepting requests with a HandlerInterceptor ................................................ 514
22.5. Resolving views ............................................................................................. 516
Resolving views with the ViewResolver interface .............................................. 516
Chaining ViewResolvers ................................................................................. 518
Redirecting to Views ....................................................................................... 518
RedirectView .......................................................................................... 519
The redirect: prefix ................................................................................. 520
The forward: prefix ................................................................................. 520
ContentNegotiatingViewResolver ..................................................................... 520
22.6. Using flash attributes ..................................................................................... 522
22.7. Building URIs ................................................................................................. 523
Building URIs to Controllers and methods ........................................................ 524
Building URIs to Controllers and methods from views ....................................... 525
22.8. Using locales ................................................................................................. 526
Obtaining Time Zone Information .................................................................... 526
AcceptHeaderLocaleResolver .......................................................................... 526
CookieLocaleResolver ..................................................................................... 526
SessionLocaleResolver ................................................................................... 527
LocaleChangeInterceptor ................................................................................ 527
22.9. Using themes ................................................................................................ 527
Overview of themes ........................................................................................ 527
Defining themes ............................................................................................. 528
Theme resolvers ............................................................................................. 528
22.10. Spring’s multipart (file upload) support ........................................................... 529
Introduction .................................................................................................... 529
Using a MultipartResolver with Commons FileUpload ........................................ 529
Using a MultipartResolver with Servlet 3.0 ....................................................... 529
Handling a file upload in a form ...................................................................... 530
Handling a file upload request from programmatic clients .................................. 531
Spring Framework Reference Documentation
4.3.2.RELEASE Spring Framework xviii
22.11. Handling exceptions ..................................................................................... 532
HandlerExceptionResolver .............................................................................. 532
@ExceptionHandler ........................................................................................ 532
Handling Standard Spring MVC Exceptions ...................................................... 533
Annotating Business Exceptions With @ResponseStatus .................................. 534
Customizing the Default Servlet Container Error Page ...................................... 534
22.12. Web Security ............................................................................................... 535
22.13. Convention over configuration support ........................................................... 535
The Controller ControllerClassNameHandlerMapping ........................................ 535
The Model ModelMap (ModelAndView) ............................................................ 536
The View - RequestToViewNameTranslator ..................................................... 537
22.14. HTTP caching support .................................................................................. 538
Cache-Control HTTP header ........................................................................... 539
HTTP caching support for static resources ....................................................... 539
Support for the Cache-Control, ETag and Last-Modified response headers in
Controllers ...................................................................................................... 540
Shallow ETag support ..................................................................................... 541
22.15. Code-based Servlet container initialization ..................................................... 542
22.16. Configuring Spring MVC ............................................................................... 543
Enabling the MVC Java Config or the MVC XML Namespace ............................ 544
Customizing the Provided Configuration ........................................................... 545
Conversion and Formatting ............................................................................. 546
Validation ....................................................................................................... 547
Interceptors .................................................................................................... 548
Content Negotiation ........................................................................................ 549
View Controllers ............................................................................................. 550
View Resolvers .............................................................................................. 550
Serving of Resources ..................................................................................... 551
Falling Back On the "Default" Servlet To Serve Resources ................................ 554
Path Matching ................................................................................................ 555
Message Converters ....................................................................................... 556
Advanced Customizations with MVC Java Config ............................................. 557
Advanced Customizations with the MVC Namespace ........................................ 558
23. View technologies ..................................................................................................... 559
23.1. Introduction .................................................................................................... 559
23.2. Thymeleaf ..................................................................................................... 559
23.3. Groovy Markup Templates .............................................................................. 559
Configuration .................................................................................................. 559
Example ......................................................................................................... 560
23.4. Velocity & FreeMarker .................................................................................... 560
Dependencies ................................................................................................ 560
Context configuration ...................................................................................... 560
Creating templates ......................................................................................... 561
Advanced configuration ................................................................................... 561
velocity.properties ................................................................................... 561
FreeMarker ............................................................................................. 562
Bind support and form handling ....................................................................... 562
The bind macros .................................................................................... 562
Simple binding ........................................................................................ 563
Form input generation macros ................................................................. 563
Spring Framework Reference Documentation
4.3.2.RELEASE Spring Framework xix
HTML escaping and XHTML compliance ................................................. 567
23.5. JSP & JSTL .................................................................................................. 567
View resolvers ................................................................................................ 568
'Plain-old' JSPs versus JSTL ........................................................................... 568
Additional tags facilitating development ............................................................ 568
Using Spring’s form tag library ........................................................................ 568
Configuration .......................................................................................... 569
The form tag .......................................................................................... 569
The input tag .......................................................................................... 570
The checkbox tag ................................................................................... 570
The checkboxes tag ............................................................................... 572
The radiobutton tag ................................................................................ 573
The radiobuttons tag ............................................................................... 573
The password tag ................................................................................... 573
The select tag ........................................................................................ 573
The option tag ........................................................................................ 574
The options tag ...................................................................................... 574
The textarea tag ..................................................................................... 575
The hidden tag ....................................................................................... 575
The errors tag ........................................................................................ 575
HTTP Method Conversion ....................................................................... 577
HTML5 Tags .......................................................................................... 578
23.6. Script templates ............................................................................................. 578
Dependencies ................................................................................................ 579
How to integrate script based templating .......................................................... 579
23.7. XML Marshalling View .................................................................................... 581
23.8. Tiles .............................................................................................................. 581
Dependencies ................................................................................................ 581
How to integrate Tiles ..................................................................................... 581
UrlBasedViewResolver ............................................................................ 582
ResourceBundleViewResolver ................................................................. 582
SimpleSpringPreparerFactory and SpringBeanPreparerFactory ................. 583
23.9. XSLT ............................................................................................................. 583
My First Words ............................................................................................... 584
Bean definitions ...................................................................................... 584
Standard MVC controller code ................................................................. 584
Document transformation ........................................................................ 585
23.10. Document views (PDF/Excel) ........................................................................ 585
Introduction .................................................................................................... 585
Configuration and setup .................................................................................. 586
Document view definitions ....................................................................... 586
Controller code ....................................................................................... 586
Subclassing for Excel views .................................................................... 586
Subclassing for PDF views ..................................................................... 588
23.11. JasperReports .............................................................................................. 588
Dependencies ................................................................................................ 588
Configuration .................................................................................................. 588
Configuring the ViewResolver .................................................................. 589
Configuring the Views ............................................................................. 589
About Report Files .................................................................................. 589
Spring Framework Reference Documentation
4.3.2.RELEASE Spring Framework xx
Using JasperReportsMultiFormatView ...................................................... 589
Populating the ModelAndView ......................................................................... 590
Working with Sub-Reports ............................................................................... 591
Configuring Sub-Report Files .................................................................. 591
Configuring Sub-Report Data Sources ..................................................... 592
Configuring Exporter Parameters ..................................................................... 592
23.12. Feed Views ................................................................................................. 593
23.13. JSON Mapping View .................................................................................... 593
23.14. XML Mapping View ...................................................................................... 594
24. Integrating with other web frameworks ....................................................................... 595
24.1. Introduction .................................................................................................... 595
24.2. Common configuration ................................................................................... 596
24.3. JavaServer Faces 1.2 .................................................................................... 597
SpringBeanFacesELResolver (JSF 1.2+) ......................................................... 597
FacesContextUtils ........................................................................................... 597
24.4. Apache Struts 2.x .......................................................................................... 597
24.5. Tapestry 5.x .................................................................................................. 598
24.6. Further Resources ......................................................................................... 598
25. Portlet MVC Framework ............................................................................................ 599
25.1. Introduction .................................................................................................... 599
Controllers - The C in MVC ............................................................................ 600
Views - The V in MVC .................................................................................... 600
Web-scoped beans ......................................................................................... 600
25.2. The DispatcherPortlet ..................................................................................... 600
25.3. The ViewRendererServlet ............................................................................... 602
25.4. Controllers ..................................................................................................... 603
AbstractController and PortletContentGenerator ............................................... 604
Other simple controllers .................................................................................. 605
Command Controllers ..................................................................................... 605
PortletWrappingController ................................................................................ 606
25.5. Handler mappings .......................................................................................... 606
PortletModeHandlerMapping ............................................................................ 607
ParameterHandlerMapping .............................................................................. 607
PortletModeParameterHandlerMapping ............................................................ 608
Adding HandlerInterceptors ............................................................................. 608
HandlerInterceptorAdapter ............................................................................... 609
ParameterMappingInterceptor .......................................................................... 609
25.6. Views and resolving them .............................................................................. 609
25.7. Multipart (file upload) support ......................................................................... 609
Using the PortletMultipartResolver ................................................................... 610
Handling a file upload in a form ...................................................................... 610
25.8. Handling exceptions ....................................................................................... 614
25.9. Annotation-based controller configuration ........................................................ 614
Setting up the dispatcher for annotation support ............................................... 614
Defining a controller with @Controller .............................................................. 615
Mapping requests with @RequestMapping ....................................................... 615
Supported handler method arguments ............................................................. 617
Binding request parameters to method parameters with @RequestParam .......... 619
Providing a link to data from the model with @ModelAttribute ............................ 619
Specifying attributes to store in a Session with @SessionAttributes .................... 620
剩余906页未读,继续阅读
2021-08-25 上传
2021-10-04 上传
2018-02-23 上传
2016-09-19 上传
2023-03-14 上传
2018-09-02 上传
267 浏览量
2018-06-06 上传
wjd_sky
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 探索AVL树算法:以Faculdade Senac Porto Alegre实践为例
- 小学语文教学新工具:创新黑板设计解析
- Minecraft服务器管理新插件ServerForms发布
- MATLAB基因网络模型代码实现及开源分享
- 全方位技术项目源码合集:***报名系统
- Phalcon框架实战案例分析
- MATLAB与Python结合实现短期电力负荷预测的DAT300项目解析
- 市场营销教学专用查询装置设计方案
- 随身WiFi高通210 MS8909设备的Root引导文件破解攻略
- 实现服务器端级联:modella与leveldb适配器的应用
- Oracle Linux安装必备依赖包清单与步骤
- Shyer项目:寻找喜欢的聊天伙伴
- MEAN堆栈入门项目: postings-app
- 在线WPS办公功能全接触及应用示例
- 新型带储订盒订书机设计文档
- VB多媒体教学演示系统源代码及技术项目资源大全
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功