Spring 3.x enterprise application development practices

Source: Internet
Author: User

Spring 3.x enterprise application development practices

Edit recommendations

Over the past 10 years, technical experts have invited you to share a Spring Festival Gala.

 

Basic Information
  • Author:Chen xionghuaLin kaixiong
  • Press: Electronic Industry Press
  • ISBN:9787121152139
  • Mounting time:
  • Published on: February 1, February 2012

Http://product.china-pub.com/198906

 

 

IntroductionSpring 3.0 is a major upgraded version launched by spring after three years of accumulation. It further strengthens spring's leading position as the first open-source platform in the Java field.
Spring 3.0 introduces many new functions and features that many Java developers are looking forward to, such as oxm, validation and formatting frameworks, and rest-style Web programming models. These new functions are highly practical and easy to use. They greatly reduce the difficulty of Java applications, especially Java Web application development, and effectively improve the elegance of application development.
Spring 3.x enterprise application development practices (including one CD. x-based on the enterprise application development explanation, after a year of major adjustments and revisions, this book continues the deep pursuit of the previous version, focuses on principles, and keeps writing styles on the technical surface, we strive to allow readers to fully understand the internal implementation of spring while familiarizing themselves with spring's functions, so that they can truly understand what it means. In addition, this book highlights the topic of "practical" and strives to make the book "go from the actual project to the actual project ". DirectorySpring 3.x enterprise application development practices (including one CD)
1st Overview
Chapter 2 spring Overview 2
1.1 understand spring 3
1.2 about springsource 4
1.3 What does spring bring to us 5
1.4 spring architecture 6
1.5 New Features of spring 3.0 8
1.5.1 core API updated to Java 5.0 8
1.5.2 spring Expression Language 8
1.5.3 provide IOC configuration information through the Java Class 9
1.5.4 general type conversion system and attribute formatting
System 10
1.5.5 oxm function added to the data access layer 10
1.5.6 web layer enhancement 10
1.5.7 other 11
1.6 Requirements of spring for Java version 11
1.7 How to obtain spring 11
1.8 conclusion 12
Chapter 4 Quick Start 13. 2nd overview of Instance functions 14
2.1.1 instances that are more suitable than Hello world 14
2.1.2 instance features 14
2.2 prepare the Environment 16
2.2.1 create database table 16
2.2.2 create a project 17
2.2.3 plan class packages and spring configuration files 19
2.3 persistent layer 20
2.3.1 create a domain object 20
2.3.2 userdao 21
2.3.3 loginlogdao 24
2.3.4 assemble Dao 24 in spring
2.4 business layer 26
2.4.1 userservice 26
2.4.2 assemble service 27 in spring
2.4.3 unit test 29
2.5 Presentation Layer 31
2.5.1 configure spring MVC Framework 31
2.5.2 process login request 33
2.5.3 JSP view page 35
2.6 run web application 37
2.7 summary 38
2nd IOC and AOP
Chapter 4 IOC container overview 40
3.1 IOC overview 41
3.1.1 understanding the concept of IOC through instances 41
3.1.2 IOC type 43
3.1.3 inject dependencies through containers 45
3.2 Basic Java knowledge 46
3.2.1 simple instance 46
3.2.2 classloader 48
3.2.3 Java reflection mechanism 51
3.3 Resource Access Tool 53
3.3.1 resource abstraction interface 53
3.3.2 resource loading 56
3.4 beanfactory and applicationcontext 58
3.4.1 beanfactory introduction 58
3.4.2 introduction to applicationcontext 61
3.4.3 Parent and Child containers 68
3.5 bean lifecycle 68
3.5.1 beanfactory bean lifecycle 68
3.5.2
Lifecycle 77
3.6 summary 79
Chapter 2 assembly of bean 80 in IOC container
4.1 spring Configuration Overview 81
4.1.1 spring container high-level view 81
4.1.2 XML-based configuration 82
4.2 bean basic configuration 84
4.2.1 assemble a bean 84
4.2.2 bean name 85
4.3 dependency injection 86
4.3.1 property injection 86
4.3.2 constructor injection 89
4.3.3 factory method injection 93
4.3.4 considerations for selecting an injection method 94
4.4 Injection Parameters 95
4.4.1 nominal value 95
4.4.2 reference other beans 96
4.4.3 internal bean 98
4.4.4 null value 98
4.4.5 cascade attribute 98
4.4.6 set type attribute 99
4.4.7 simplified configuration 103
4.4.8 automatic assembly 106
4.5 Method injection 107
4.5.1 injection of The lookup method 107
4.5.2 replace method 108
4.6 relationship between [Beans] 109
4.6.1 inherit 109
4.6.2 depends on 110
4.6.3 reference 111
4.7 integrate multiple configuration files 112
4.8 bean scope 113
4.8.1 Singleton scope 113
4.8.2 prototype scope 114
4.8.3 bean related to Web application environment
Scope 115
4.8.4 scope dependency problem 117
4.9 factorybean 118
4.10 annotation-based configuration 120
4.10.1 define bean 120 using annotations
4.10.2 use annotation configuration information to start spring
Container 120
4.10.3 automatically assemble bean 122
4.10.4 bean scope and life process method 125
4.11 Java-class-based configuration 127
4.11.1 provide bean definitions using Java classes
Message 127
4.11.2 use Java-class-based configuration information
Start spring container 130
4.12 Comparison of Different configuration methods 132
4.13 conclusion 134
Chapter 2 advanced spring container theme 5th
5.1 spring container technology insider 136
5.1.1 internal mechanism 136
5.1.2 beandefinition 139
5.1.3 instantiationstrategy 140
5.1.4 beanwrapper 140
5.2 Attribute Editor 141
5.2.1 JavaBean editor 142
5.2.2 spring default Attribute Editor 145
5.2.3 custom attribute editor 146
5.3 use an external property file 149
5.3.1 Use External Property file 149
5.3.2 use encrypted attribute file 151
5.3.3 attribute file reference 155
5.4 reference bean property value 156
5.5 International Information 158
5.5.1 basics 158
5.5.2 messagesource 163
5.5.3 container-level international information resource 166
5.6 container event 167
5.6.1 spring event class structure 168
5.6.2 deconstruct the specific spring Event System
Achieve 169
5.6.3 170 per instance
5.7 conclusion 172
Chapter 2 Spring AOP basics 6th
6.1 AOP overview 174
6.1.1 what is AOP 174
6.1.2 AOP terminology 176
6.1.3 AOP implementer 178
6.2 basic knowledge 178
6.2.1 instance with cross-cutting logic 178
6.2.2 JDK dynamic proxy 181
6.2.3 dynamic cglib proxy 184
6.2.4 AOP Alliance 186
6.2.5 proxy knowledge summary 186
6.3 create enhancement class 187
6.3.1 enhanced type 187
6.3.2 enhancement 188
6.3.3 post enhancement 192
6.3.4 enhancement in the circle 193
6.3.5 exception throw increase by 194
6.3.6 introduction enhancement 196
6.4 create a cut section 199
6.4.1 cut point type 200
6.4.2 section type 201
6.4.3 static common method name matching aspect 203
6.4.4 static regular expression method matching aspect 205
6.4.5 dynamic section 208
6.4.6 flow aspect 211
6.4.7 compound cut point section 213
6.4.8 introduction aspect 215
6.5 automatically create proxy 216
6.5.1 implementation class Introduction 217
6.5.2 beannameautoproxycreator 217
6.5.3 defaultadvisorautoproxycreator 219
6.6 conclusion 220
Chapter 2 AOP 7th Based on @ aspectj and schema
7.1 spring supports 222 of AOP
7.2 JDK 5.0 quick introduction to annotation knowledge 222
7.2.1 understand the annotation 222
7.2.2 a simple annotation 223
7.2.3 use annotation 224
7.2.4 access annotation 225
7.3 getting started with @ aspectj 226
7.3.1 preparations before use 226
7.3.2 a simple example 227
7.3.3 how to use @ aspectj through Configuration
Aspect 229
7.4 @ aspectj syntax basics 230
7.4.1 cut-point Expression Function 230
7.4.2 use wildcard 231 in function input parameters
7.4.3 logical operator 232
7.4.4 different enhancement types 232
7.4.5 introduction enhancement usage 233
7.5 cut-point function details 235
7.5.1 @ annotice () 235
7.5.2 Executor () 237
7.5.3 ARGs () and @ ARGs () 238
7.5.4 within () 240
7.5.5 @ within () & @ target () 240
7.5.6 this () 241 of target ()
7.6 @ aspectj advanced 243
7.6.1 cut point compound operation 243
7.6.2 naming cut point 244
7.6.3 enhancing the weaving sequence 245
7.6.4 access connection point information 246
7.6.5 bind join point method input parameter 247
7.6.6 bind a proxy object 249
7.6.7 bind class annotation object 249
7.6.8 bind return value 250
7.6.9 exception thrown by binding 251
7.7 Schema-based configuration section 252
7.7.1 configuration of a simple Section 252
7.7.2 configuration name cut point 253
7.7.3 configurations of various enhancement types 255
7.7.4 binding connection point information 257
7.7.5 configure advisor 258
7.8 mixed section type 259
7.8.1 mixed use of various section types 260
7.8.2 Summary of various section types 261
7.9 JVM class file bytecode conversion Basics
Knowledge 1, 261
7.9.1 java. Lang. instrument package operations
Principles 262
7.9.2 how to register a converter 263 with JVM
7.9.3 use JVM to start parameter Registration
Converter issue 265
7.10 use LTW to weave the inner plane 265
7.10.1 spring loadtimeweaver 266
7.10.2 use LTW to weave a cut section 268
7.10.3 configuration 270 in Tomcat
7.10.4
Configure 271
7.11 conclusion 271
3rd Data Access
Chapter 2 support for dao by spring 8th
8.1 Dao concept of spring 275
8.2 unified exception system 275
8.2.1 spring Dao exception system 276
8.2.2 JDBC exception converter 278
8.2.3 exception converter for other persistent technologies 278
8.3 unified data access template 279
8.3.1 use the template and callback mechanism 279
8.3.2 spring is used by different Persistence Technologies
Template Class 281
8.4 data source 282
8.4.1 configure a data source 282
8.4.2 obtain the JNDI data source 287
8.4.3 spring Data Source implementation class 287
8.5 Conclusion 288
Chapter 2 Spring transaction management 9th
9.1 basic knowledge of database transactions 290
9.1.1 what is Database Transaction 290
9.1.2 concurrency 291
9.1.3 database lock 293
9.1.4 transaction isolation 294
9.1.5 JDBC supports 294 transactions
9.2 basic threadlocal knowledge 296
9.2.1 what is threadlocal 296
9.2.2 threadlocal interface method 297
9.2.3 one theadlocal instance 298
9.2.4 comparison with thread synchronization mechanism 299
9.2.5 use threadlocal in spring
Thread security issue 300
9.3 spring's support for transaction management 301
9.3.1 transaction management key abstraction 302
9.3.2 implement class 305 in spring's Transaction Manager
9.3.3 transaction synchronization manager 307
9.3.4 transaction propagation 309
9.4 programmatic Transaction Management 309
9.5 configure declarative transactions using XML 310
9.5.1 a transaction to be implemented will be enhanced
Service Interface 312
9.5.2 use the original
Transaction proxyfactorybean 313
9.5.3 configuration based on the Tx/AOP namespace 315
9.6 configure declarative transactions with annotations 318
9.6.1 use @ transactional annotation 318
9.6.2 introduce transactions through aspectj LTW
Aspect 322
9.7 integrate specific application servers 323
9.7.1 BEA WebLogic 324
9.7.2 BEA WebLogic 324
9.8 conclusion 324
Chapter 2 Analysis of difficulties in Spring transaction management 10th
10.1 connecting Dao and transaction management 326
10.1.1 JDBC Access Database 326
10.1.2 accessing the database through hibernate 328
10.2 application layering confusion 330
10.3 confusion about nested calling of transaction methods 334
10.3.1 Review of Spring transaction propagation mechanism 334
10.3.2 nested service method 335
10.4 multi-thread confusions 338
10.4.1 spring uses a single instantiation Bean
Simplify multithreading 338
10.4.2 start an independent thread to call the transaction method 338
10.5 chaos in joint military operations 340
10.5.1 response to spring Transaction Manager 340
10.5.2 hibernate + spring JDBC
Hybrid Framework Transaction Management 341
10.6 special methods into the fish that have missed the net 345
10.6.1 which methods cannot implement Spring AOP
Transaction 345
10.6.2 example of transaction enhancement omission 345
10.7 data connection leakage 349
10.7.1 access to underlying connection resources 349
10.7.2 spring JDBC data connection leakage 350
10.7.3 obtained through ceceutils
Data Connection 353
10.7.4 obtained through ceceutils
Data Connection 355
10.7.5 how to connect jdbctemplate
Leakage immune 357
10.7.6 use transactionawaredata
Sourceproxy 357
10.7.7 equivalence classes of other data access technologies 358
10.8 conclusion 359
Chapter 5 accessing a database using spring JDBC 11th
11.1 use spring JDBC 362
11.1.1 jdbctemplate test tool 362
11.1.2 use jdbctemplate 363 in Dao
11.2 Basic Data Operations 364
11.2.1 change data 364
11.2.2 return the auto-incrementing primary key value of the database table 367
11.2.3 Batch Data Change 369
11.2.4 query data 370
11.2.5 query single-value data 373
11.2.6 call Stored Procedure 375
11.3 blob/clob Data Operations 377
11.3.1 how to obtain local data connection 377
11.3.2 related operation interface 379
11.3.3 insert lob data 380
11.3.4 read lob data in block data mode: 383
11.3.5 read lob data in stream mode 383
11.4 auto-increment key and row set 384
11.4.1 auto-incrementing Key Usage 384
11.4.2 how to plan the primary key scheme 386
11.4.3 return data in a row set: 388
11.5 Other Types of jdbctemplate 389
11.5.1 namedparameterjdbctemplate 389
11.5.2 simplejdbctemplate 391
11.6 access the database in OO mode 391
11.6.1 query using mappingsqlquery
Data 391
11.6.2 update data 393 using sqlupdate
11.6.3 use storedprocedure to execute storage
Process 394
11.6.4 sqlfunction 396
11.7 Conclusion 396
Chapter 5 integrate other ORM frameworks 12th
12.1 integrate ORM technology with spring 399
12.2 use hibernate 400 in spring
12.2.1 configure sessionfactory 400
12.2.2 use hibernatetemplate 403
12.2.3 process lob data 407
12.2.4 add hibernate event listener 409
12.2.5 use native hibernate API 409
12.2.6 configure 410 using annotations
12.2.7 transaction processing 412
12.2.8 delayed Loading Problem 413
12.3 use mybatis 414 in spring
12.3.1 configure sqlmapclient 415
12.3.2 configure mybatis 416 in spring
12.3.3 write Dao 417 of mybatis
12.5 Dao layer design 420
12.5.1 Design of Dao base classes 421
12.5.2 Design of query interface method 423
12.5.3 paging query interface design 424
12.6 conclusion 425
Article 3 business layer and web Layer Technology
Chapter 2 Task Scheduling and asynchronous actuator 13th
13.1 task scheduling overview 429
13.2 quartz quick advanced 429
13.2.1 quartz infrastructure 430
13.2.2 use simpletrigger 432
13.2.3 use crontrigger 434
13.2.4 use calendar 437
13.2.5 job scheduling information storage 439
13.3 use quartz 442 in spring
13.3.1 create jobdetail 442
13.3.2 create trigger 444
13.3.3 create scheduler 446
13.4 use JDK timer 447 in spring
13.4.1 timer and timertask 448
13.4.2 spring supports JDK timer 450
13.5 spring for JDK 5.0 executor
451
13.5.1 understand executor 5.0 of JDK 452
13.5.2 what Spring provides to executor
Abstraction 454
13.6 Task Scheduling in actual application 455
13.6.1 how to generate task 456
13.6.2
Impact 457
13.6.3 task scheduling cloud 458
13.6.4
460 of startup and shutdown Problems
13.7 conclusion 462
Chapter 2 using oxm for object XML ing 14th
14.1 understanding of XML parsing technology 464
14.1.1 what is XML 464
14.1.2 XML processing 464
14.2 XML processing tool: xstream 466
14.2.1 xstream overview 466
466 Quick Start
14.2.3 use xstream alias 469
14.2.4 xstream converter 470
14.2.5 xstream annotation 472
14.2.6 streaming object 474
14.2.7 persistence API 475
14.2.8 additional functions: Process JSON 476
14.3 other common o/X mapping open-source projects 478
14.3.1 jaxb 478
14.3.2 xmlbeans 482
14.3.3 Castor 485
14.3.4 jibx 490
14.3.5 Conclusion Compared to 493
14.4 integration with spring oxm 494
14.4.1 spring oxm overview 494
14.4.2 integrating oxm implementers 496
14.4.3 how to configure 497 in spring
14.4.4 spring oxm simple instance 499
14.5 conclusion 501
Chapter 2 spring MVC 15th
15.1 spring MVC overview 504
15.1.1 architecture: 504
15.1.2 configure dispatcherservlet 505
15.1.3 a simple instance 510
15.2 annotation-driven controller 514
15.2.1 use @ requestmapping
Request 514
15.2.2 request processing method signature overview 518
15.2.3 detailed description of processing method signatures 519
15.2.4 use httpmessageconverter [T] 523.
15.2.5 model data processing 532
15.3 data binding for Processing Methods 538
15.3.1 data binding process analysis 539
15.3.2 data conversion 539
15.3.3 format data 545
15.3.4 data verification 549
15.4 view and view parser 558
15.4.1 view recognition 558
15.4.2 understanding view parser 560
15.4.3 JSP and jstl 561
15.4.4 template view 565
15.4.5 Excel 569
15.4.6 PDF 570
15.4.7 output XML 572
15.4.8 output JSON 573
15.4.9 use xmlviewresolver 573
15.4.10 use resourcebundle
View resolver 574
15.4.11 mixed use of multiple view technologies 575
15.5 localization resolution 577
15.5.1 local overview 577
15.5.2 use cookielocaleresolver 578.
15.5.3 use sessionlocaleresolver 579
15.5.4 use localechangeinterceptor 579
15.6 File Upload 579
15.6.1 configure multipartresolver 580
15.6.2 controller and file upload form page 580
15.7 miscellaneous 581
15.7.1 static resource processing 581
15.7.2 assemble interceptor 586
15.7.3 handling exceptions 587
15.8 conclusion 589
5th tests and practices
Chapter 4 practical unit testing 16th
16.1 unit test overview 593
16.1.1 why unit test 593
16.1.2 misunderstanding of unit test 594
16.1.3 difficulties in unit testing 595
16.1.4 basic concepts of unit testing 596
16.2 JUnit 4 fast advanced 600
16.2.1 JUnit 4 OVERVIEW 600
16.2.2 JUnit 4 lifecycle 601
16.2.3 use of JUnit 4 601
16.3 simulation tool mockito 608
16.3.1 testing overview 608
16.3.2 create mock object 608
16.3.3 set the expected behavior and
Return Value 609
16.3.4 verify interaction 611
16.4 Wang unitils 612
16.4.1 unitils overview 612
16.4.2 integrate Spring 615
16.4.3 integrate with hibernate 618
16.4.4 integrate dbunit 619
16.4.5 custom extension module 620
16.5 use unitils to test Dao layer 620
16.5.1 difficulties in database testing 621
16.5.2 expand dbunit to prepare data in Excel 621
16.5.3 test practice 624
16.6 use unitils to test service layer 634
16.7 test web layer 639
16.7.1 unit logincontroller
Test 640
16.7.2 simulate using spring servlet API
Object 641
16.7.3 use spring resttemplate to test 642
16.7.4 use selenium test 644
16.8 conclusion 647
Chapter 2 practical case development 17th
17.1 Forum case overview 649
17.1.1 overall function structure of the Forum 649
17.1.2 Forum Case 649
17.1.3 main function process description 651
17.2 system design 655
17.2.1 technical framework selection 655
17.2.2 web directory structure and class package structure Planning 656
17.2.3 unit test package structure Planning 657
System Structure 657
17.2.5 class design of Po 658
17.2.6 persistent layer design 659
17.2.7 Design of service layer 659
17.2.8 web layer design 660
17.2.9 Database Design: 661
17.3 preparations before development 663
17.4 Persistence Layer Development 664
17.4.1 Po 664
17.4.2 Dao base class 666
17.4.3 define DAO class 671 by extending the base class
17.4.4 Dao bean Assembly 672
17.4.5 use hibernate Level 2 Cache 674
17.5 test the persistent layer 676
17.5.1 configure the unitils test environment 676
17.5.2 prepare the test database and test data 677
17.5.3 write Dao Test base class 678
17.5.4 compiling boarddao Test Case 678
17.6 service layer development 680
17.6.1 development of userservice 680
17.6.2 forumservice development 682
17.6.3 assembly of service bean 685
17.7 test the service layer 686
17.7.1 service test base class 687
17.7.2 compiling forumservice Test Case 687
17.8 web layer development 689
17.8.1 base class 689 of basecontroller
17.8.2 user logon and cancellation 691
17.8.3 user registration 692
17.8.4 manage Forum 694
17.8.5 common forum function 696
17.8.6 the topic posts in the Forum section are displayed on the page 698.
17.8.7 configure web. xml 702
17.8.8 configure spring MVC 704
17.9 test the web layer 705
17.9.1 compile the Web Test base class 705
17.9.2 compile forummanagecontroller
Test Case 706
17.10 deploy and run applications 707
17.11 conclusion 710
For the following content, see the book-related CD:
Appendix A javamail send email 711
Appendix B developing Web Service 738 in spring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.