SpringByExample.pdf
(
1164 KB
)
Pobierz
Spring by Example
David Winterfeldt
Version 1.4
Copyright
©
2008-2014 David Winterfeldt
Table of Contents
Preface ..................................................................................................................................... xi
1. Spring: Evolution Over Intelligent Design ........................................................................... xi
2. A Little History .............................................................................................................. xi
3. Goals of This Book ........................................................................................................ xii
4. A Note about Format ...................................................................................................... xii
I. Spring Introduction ................................................................................................................. 14
Spring In Context: Core Concepts ........................................................................................ 15
1. Spring and Inversion of Control ................................................................................ 16
Dependency Inversion: Precursor to Dependency Injection ....................................... 16
2. Dependency Injection To The Rescue ........................................................................ 19
3. Bean management through IoC ................................................................................. 20
4. Our Example In Spring IoC ..................................................................................... 20
A Practical Introduction to Inversion of Control ...................................................................... 21
1. Basic Bean Creation ............................................................................................... 21
2. Basic Constructor Injection ...................................................................................... 22
3. Basic Setter Injection .............................................................................................. 23
4. Reference Injection ................................................................................................ 24
5. Creating a Spring Application .................................................................................. 25
6. Unit Test Beans from Application Context .................................................................. 26
7. Getting Started ...................................................................................................... 28
Setup .............................................................................................................. 28
8. Reference ............................................................................................................. 28
Related Links ................................................................................................... 29
Project Information ........................................................................................... 29
II. Core ................................................................................................................................... 30
AspectJ Load-time Weaving in Spring .................................................................................. 31
1. JVM Argument ..................................................................................................... 31
2. Spring Configuration .............................................................................................. 31
3. AspectJ Configuration ............................................................................................ 32
4. Code Example ....................................................................................................... 32
5. Reference ............................................................................................................. 33
Related Links ................................................................................................... 33
Project Setup .................................................................................................... 33
Project Information ........................................................................................... 33
III. Persistence .......................................................................................................................... 34
Simple Spring JDBC Template ............................................................................................ 35
1. Spring Configuration .............................................................................................. 35
2. Code Example ....................................................................................................... 35
3. Reference ............................................................................................................. 35
Related Links ................................................................................................... 36
Simple Hibernate XML Configuration .................................................................................. 37
1. Spring Configuration .............................................................................................. 37
2. Hibernate Configuration .......................................................................................... 37
3. SQL Script ........................................................................................................... 38
Spring by Example Version 1.4
Spring by Example
ii
Spring by Example
4. Code Example ....................................................................................................... 38
5. Reference ............................................................................................................. 39
Related Links ................................................................................................... 39
One to Many Hibernate XML Configuration .......................................................................... 40
1. Spring Configuration .............................................................................................. 40
2. Hibernate Configuration .......................................................................................... 41
3. SQL Script ........................................................................................................... 42
4. Code Example ....................................................................................................... 42
5. Reference ............................................................................................................. 43
Related Links ................................................................................................... 43
Project Setup .................................................................................................... 44
Project Information ........................................................................................... 44
One to Many Hibernate Annotation Configuration ................................................................... 45
1. Spring Configuration .............................................................................................. 45
2. Hibernate Configuration .......................................................................................... 46
3. SQL Script ........................................................................................................... 49
4. Code Example ....................................................................................................... 50
5. Reference ............................................................................................................. 51
Related Links ................................................................................................... 51
Project Setup .................................................................................................... 51
Project Information ........................................................................................... 51
One to Many JPA Hibernate Configuration ............................................................................ 52
1. Spring Configuration .............................................................................................. 52
2. JPA Entity Configuration ........................................................................................ 53
3. JPA Configuration ................................................................................................. 56
4. Code Example ....................................................................................................... 57
5. Reference ............................................................................................................. 59
Related Links ................................................................................................... 59
Project Setup .................................................................................................... 59
Project Information ........................................................................................... 60
JPA Joined Inheritance ....................................................................................................... 61
1. Spring Configuration .............................................................................................. 61
2. JPA Entity Configuration ........................................................................................ 62
3. JPA Configuration ................................................................................................. 65
4. Code Example ....................................................................................................... 66
5. SQL Script ........................................................................................................... 67
6. Reference ............................................................................................................. 68
Related Links ................................................................................................... 68
Project Setup .................................................................................................... 68
Project Information ........................................................................................... 69
Spring Data JPA ............................................................................................................... 70
1. Spring Configuration .............................................................................................. 70
2. JPA Configuration ................................................................................................. 71
3. Repository ............................................................................................................ 71
4. Code Example ....................................................................................................... 73
5. Reference ............................................................................................................. 75
Related Links ................................................................................................... 75
Project Setup .................................................................................................... 75
Project Information ........................................................................................... 76
Spring by Example Version 1.4
Spring by Example
iii
Spring Data JPA Auditing ................................................................................................... 77
1. Spring Configuration .............................................................................................. 77
2. JPA Configuration ................................................................................................. 77
3. Code Example ....................................................................................................... 78
4. SQL Script ........................................................................................................... 80
5. Reference ............................................................................................................. 81
Related Links ................................................................................................... 81
Project Setup .................................................................................................... 81
Project Information ........................................................................................... 82
Hibernate Transaction Annotation Configuration ..................................................................... 83
1. Spring Configuration .............................................................................................. 83
2. Code Example ....................................................................................................... 83
3. Reference ............................................................................................................. 84
Related Links ................................................................................................... 84
Project Setup .................................................................................................... 85
Project Information ........................................................................................... 85
Simple Spring Transactional JUnit 4 Test .............................................................................. 86
1. Spring Configuration .............................................................................................. 86
2. Code Example ....................................................................................................... 86
3. Reference ............................................................................................................. 88
Related Links ................................................................................................... 88
Project Setup .................................................................................................... 88
Project Information ........................................................................................... 89
IV. Web .................................................................................................................................. 90
Simple Tiles 2 Spring MVC Webapp .................................................................................... 91
1. Spring Configuration .............................................................................................. 91
2. Tiles XML Configuration ........................................................................................ 91
3. JSP Example ......................................................................................................... 92
4. Reference ............................................................................................................. 93
Related Links ................................................................................................... 93
Project Setup .................................................................................................... 93
Project Information ........................................................................................... 93
Basic Webapp Internationalization ....................................................................................... 94
1. Web Configuration ................................................................................................. 94
2. Spring Configuration .............................................................................................. 94
3. JSP Example ......................................................................................................... 95
4. Message Resource Property Files .............................................................................. 96
5. Reference ............................................................................................................. 96
Related Links ................................................................................................... 96
Project Setup .................................................................................................... 97
Project Information ........................................................................................... 97
Simple Spring MVC Form Annotation Configuration Webapp ................................................... 98
1. Web Configuration ................................................................................................. 98
2. Spring Configuration .............................................................................................. 99
3. JSP Example ....................................................................................................... 100
4. Code Example ..................................................................................................... 101
5. Reference ........................................................................................................... 103
Related Links ................................................................................................. 103
Project Setup .................................................................................................. 103
Spring by Example Version 1.4
Spring by Example
iv
Spring by Example
Project Information .........................................................................................
Simple Spring Security Webapp .........................................................................................
1. Web Configuration ...............................................................................................
2. Spring Configuration ............................................................................................
3. JSP Example .......................................................................................................
4. Code Example .....................................................................................................
5. SQL Script .........................................................................................................
6. Reference ...........................................................................................................
Related Links .................................................................................................
Project Setup ..................................................................................................
Project Information .........................................................................................
Simple Spring Web Flow Webapp ......................................................................................
1. Web Configuration ...............................................................................................
2. Spring Configuration ............................................................................................
3. JSP Example .......................................................................................................
4. Code Example .....................................................................................................
5. Reference ...........................................................................................................
Related Links .................................................................................................
Project Setup ..................................................................................................
Project Information .........................................................................................
Spring Web Flow Subflow Webapp ....................................................................................
1. Spring Configuration ............................................................................................
2. JSP Example .......................................................................................................
3. Code Example .....................................................................................................
4. Reference ...........................................................................................................
Related Links .................................................................................................
Project Setup ..................................................................................................
Project Information .........................................................................................
Simple Grails Webapp .....................................................................................................
1. Create Application ...............................................................................................
2. Modify Code ......................................................................................................
3. Run Application ..................................................................................................
4. Reference ...........................................................................................................
Related Links .................................................................................................
Project Setup ..................................................................................................
Project Information .........................................................................................
Simple Flex Webapp ........................................................................................................
1. Web Configuration ...............................................................................................
2. Spring Configuration ............................................................................................
3. Adobe BlazeDS Configuration ...............................................................................
4. Code Example .....................................................................................................
5. Flex Code Example ..............................................................................................
6. Reference ...........................................................................................................
Related Links .................................................................................................
Project Setup ..................................................................................................
Project Information .........................................................................................
V. Enterprise ..........................................................................................................................
Simple Spring JMS ..........................................................................................................
1. Producer Configuration .........................................................................................
104
105
105
106
107
108
109
109
109
109
110
111
111
111
115
117
119
119
119
119
120
120
124
128
130
130
131
131
132
132
134
136
136
136
136
137
138
138
139
140
142
142
149
149
149
149
150
151
151
Spring by Example Version 1.4
Spring by Example
v
Plik z chomika:
tostao
Inne pliki z tego folderu:
MACHINE_LEARNING_WITH_SPARK.mobi
(9075 KB)
9781783288519-MACHINE_LEARNING_WITH_SPARK.epub
(5787 KB)
9781783288519-MACHINE_LEARNING_WITH_SPARK.pdf
(4699 KB)
Akka in Action.pdf
(16058 KB)
Amazon Web Services in Action.pdf
(26379 KB)
Inne foldery tego chomika:
Pliki dostępne do 19.01.2025
bmw-gps
filmy
jezyki
komorka_dzwonki
Zgłoś jeśli
naruszono regulamin