Suchen und Finden
Title Page
2
Copyright Page
3
Contents at a Glance
4
Table of Contents
6
About the Author
13
About the Technical Reviewers
14
Acknowledgments
15
Introduction
16
Who This Book Is For
16
How This Book Is Structured
17
Conventions
19
Prerequisites
19
Downloading the Code
19
Contacting the Author
19
PART 1 Core
20
CHAPTER 1 Inversion of Control and Containers
21
1-1.Using a Container toManageYour Components
22
Problem
22
Solution
22
How It Works
22
Separating Interface from Implementation
22
Employing a Container
24
1-2.Using a Service Locator to Reduce Lookup Complexity
27
Problem
27
Solution
27
How It Works
27
1-3. Applying Inversion of Control and Dependency Injection
29
Problem
29
Solution
29
How It Works
29
1-4.Understanding Different Types of Dependency Injection
31
Problem
31
Solution
31
How It Works
31
Setter Injection (Type 2 IoC)
31
Constructor Injection (Type 3 IoC)
32
Interface Injection (Type 1 IoC)
33
1-5. Configuring a Container with a Configuration File
35
Problem
35
Solution
35
How It Works
35
1-6. Summary
38
CHAPTER 2 Introduction to Spring
39
2-1. Introducing the Spring Framework
39
Introducing Spring’s Modules
40
Introducing Spring’s Releases
41
Introducing Spring’s Projects
43
2-2. Installing the Spring Framework
44
Problem
44
Solution
44
How It Works
44
Installing JDK
44
Installing a Java IDE
44
Downloading and Installing Spring
44
Exploring Spring’s Installation Directory
45
2-3. Setting Up a Spring Project
46
Problem
46
Solution
46
How It Works
46
Setting Up the Classpath
46
Creating the Bean Configuration File
46
Using Beans from the Spring IoC Container
47
2-4. Installing Spring IDE
48
Problem
48
Solution
48
How It Works
48
2-5.Using Spring IDE’s Bean-Supporting Features
50
Problem
50
Solution
50
How It Works
50
Creating a Spring Project
50
Creating a Spring Bean Configuration File
50
Viewing Spring Beans in Spring Explorer
53
Viewing Spring Beans in Spring Beans Graph
54
Using Content Assist in Bean Configuration Files
55
Validating Bean Configuration Files
55
Searching Spring Beans
56
2-6. Summary
57
CHAPTER 3 Bean Configuration in Spring
58
3-1. Configuring Beans in the Spring IoC Container
58
Problem
58
Solution
58
How It Works
59
Creating the Bean Class
59
Creating the Bean Configuration File
60
Declaring Beans in the Bean Configuration File
60
Defining Bean Properties by Shortcut
62
3-2. Instantiating the Spring IoC Container
62
Problem
62
Solution
62
How It Works
63
Instantiating a Bean Factory
63
Instantiating an Application Context
64
Getting Beans from the IoC Container
64
3-3. Resolving Constructor Ambiguity
65
Problem
65
Solution
65
How It Works
65
3-4. Specifying Bean References
68
Problem
68
Solution
68
How It Works
68
Specifying Bean References for Setter Methods
69
Declaring Inner Beans
72
3-5. Checking Properties with Dependency Checking
72
Problem
72
Solution
72
How It Works
73
Checking Properties of the Simple Types
73
Checking Properties of the Object Types
74
Checking Properties of All Types
74
Dependency Checking and Constructor Injection
74
3-6. Checking Properties with the @Required Annotation
75
Problem
75
Solution
75
How It Works
75
3-7. Auto-Wiring Beans with XML Configuration
77
Problem
77
Solution
77
How It Works
78
Auto-Wiring by Type
78
Auto-Wiring by Name
79
Auto-Wiring by Constructor
80
Auto-Wiring by Auto-Detection
80
Auto-Wiring and Dependency Checking
81
3-8. Auto-Wiring Beans with @Autowired and @Resource
81
Problem
81
Solution
81
How It Works
82
Auto-Wiring a Single Bean of Compatible Type
82
Auto-Wiring All Beans of Compatible Type
84
Auto-Wiring by Type with Qualifiers
86
Auto-Wiring by Name
87
3-9. Inheriting Bean Configuration
88
Problem
88
Solution
88
How It Works
88
3-10.Defining Collections for Bean Properties
91
Problem
91
Solution
91
How It Works
92
Lists, Arrays, and Sets
92
Maps and Properties
95
Merging the Collection of the Parent Bean
97
3-11. Specifying the Data Type for Collection Elements
98
Problem
98
Solution
98
How It Works
99
3-12.Defining Collections Using Factory Beans and the Utility Schema
101
Problem
101
Solution
101
How It Works
101
Specifying the Concrete Class for Collections
101
Defining Stand-Alone Collections
102
3-13. Scanning Components from the Classpath
103
Problem
103
Solution
104
How It Works
104
Scanning Components Automatically
106
Filtering Components to Scan
108
Naming Detected Components
108
3-14. Summary
109
CHAPTER 4 Advanced Spring IoC Container
110
4-1. Creating Beans by Invoking a Constructor
110
Problem
110
Solution
110
How It Works
110
4-2. Creating Beans by Invoking a Static Factory Method
114
Problem
114
Solution
114
How It Works
114
4-3. Creating Beans by Invoking an Instance Factory Method
115
Problem
115
Solution
115
How It Works
115
4-4. Creating Beans Using Spring’s Factory Bean
117
Problem
117
Solution
117
How It Works
117
4-5.Declaring Beans from Static Fields
119
Problem
119
Solution
119
How It Works
119
4-6.Declaring Beans from Object Properties
121
Problem
121
Solution
121
How It Works
121
4-7. Setting Bean Scopes
123
Problem
123
Solution
123
How It Works
123
4-8. Customizing Bean Initialization and Destruction
125
Problem
125
Solution
126
How It Works
126
Implementing the InitializingBean and DisposableBean Interfaces
128
Annotating the @PostConstruct and @PreDestroy Annotations
129
4-9.Making Beans Aware of the Container
131
Problem
131
Solution
131
How It Works
132
4-10. Creating Bean Post Processors
132
Problem
132
Solution
132
How It Works
133
4-11. Externalizing Bean Configurations
137
Problem
137
Solution
137
How It Works
137
4-12. Resolving Text Messages
138
Problem
138
Solution
138
How It Works
138
4-13. Communicating with Application Events
140
Problem
140
Solution
141
How It Works
141
Defining Events
141
Publishing Events
142
Listening to Events
142
4-14. Registering Property Editors in Spring
143
Problem
143
Solution
143
How It Works
143
4-15. Creating Custom Property Editors
146
Problem
146
Solution
146
How It Works
146
4-16. Loading External Resources
148
Problem
148
Solution
148
How It Works
149
Resource Prefixes
150
Injecting Resources
150
4-17. Summary
151
CHAPTER 5 Dynamic Proxy and Classic Spring AOP
152
5-1. Problems with Non-Modularized Crosscutting Concerns
153
Tracing the Methods
154
Validating the Arguments
157
Identifying the Problems
159
5-2.Modularizing Crosscutting Concerns with Dynamic Proxy
161
Problem
161
Solution
161
How It Works
162
Creating the Logging Proxy
162
Creating the Validation Proxy
165
5-3.Modularizing Crosscutting Concerns with Classic Spring Advices
167
Problem
167
Solution
168
How It Works
168
Before Advices
169
After Returning Advices
172
After Throwing Advices
173
Around Advices
175
5-4.Matching Methods with Classic Spring Pointcuts
177
Problem
177
Solution
177
How It Works
177
Method Name Pointcuts
177
Regular Expression Pointcuts
179
AspectJ Expression Pointcuts
179
5-5. Creating Proxies for Your Beans Automatically
180
Problem
180
Solution
180
How It Works
180
5-6. Summary
182
CHAPTER 6 Spring 2.x AOP and AspectJ Support
183
6-1. Enabling AspectJ Annotation Support in Spring
184
Problem
184
Solution
184
How It Works
184
6-2.Declaring Aspects with AspectJ Annotations
186
Problem
186
Solution
186
How It Works
187
Before Advices
187
After Advices
188
After Returning Advices
189
After Throwing Advices
190
Around Advices
191
6-3. Accessing the Join Point Information
192
Problem
192
Solution
192
How It Works
193
6-4. Specifying Aspect Precedence
194
Problem
194
Solution
194
How It Works
194
6-5. Reusing Pointcut Definitions
196
Problem
196
Solution
196
How It Works
196
6-6.Writing AspectJ Pointcut Expressions
198
Problem
198
Solution
198
How It Works
198
Method Signature Patterns
198
Type Signature Patterns
200
Bean Name Patterns
201
Combining Pointcut Expressions
201
Declaring Pointcut Parameters
202
6-7. Introducing Behaviors to Your Beans
203
Problem
203
Solution
203
How It Works
203
6-8. Introducing States to Your Beans
206
Problem
206
Solution
206
How It Works
206
6-9.Declaring Aspects with XML-Based Configurations
208
Problem
208
Solution
208
How It Works
209
Declaring Aspects
209
Declaring Pointcuts
210
Declaring Advices
210
Declaring Introductions
211
6-10. Load-Time Weaving AspectJ Aspects in Spring
212
Problem
212
Solution
212
How It Works
212
Load-Time Weaving by the AspectJ Weaver
215
Load-Time Weaving by Spring 2.5 Load-Time Weaver
216
6-11. Configuring AspectJ Aspects in Spring
217
Problem
217
Solution
217
How It Works
217
6-12. Injecting Spring Beans into Domain Objects
218
Problem
218
Solution
218
How It Works
219
6-13. Summary
222
PART 2 Fundamentals
223
CHAPTER 7 Spring JDBC Support
224
7-1. Problems with Direct JDBC
224
Setting Up the Application Database
225
Understanding the Data Access Object Design Pattern
226
Implementing the DAO with JDBC
227
Configuring a Data Source in Spring
229
Running the DAO
231
7-2.Using a JDBC Template to Update a Database
231
Problem
231
Solution
232
How It Works
232
Updating a Database with a Statement Creator
232
Updating a Database with a Statement Setter
234
Updating a Database with a SQL Statement and Parameter Values
234
Batch Updating a Database
235
7-3.Using a JDBC Template to Query a Database
236
Problem
236
Solution
237
How It Works
237
Extracting Data with a Row Callback Handler
237
Extracting Data with a Row Mapper
238
Querying for Multiple Rows
239
Querying for a Single Value
241
7-4. Simplifying JDBC Template Creation
242
Problem
242
Solution
242
How It Works
243
Injecting a JDBC Template
243
Extending the JdbcDaoSupport Class
244
7-5.Using the Simple JDBC Template with Java 1.5
245
Problem
245
Solution
245
How It Works
245
Using a Simple JDBC Template to Update a Database
245
Using a Simple JDBC Template to Query a Database
246
7-6.Using Named Parameters in a JDBC Template
248
Problem
248
Solution
249
How It Works
249
7-7.Modeling JDBC Operations As Fine-Grained Objects
251
Problem
251
Solution
251
How It Works
251
Update Operation Objects
251
Query Operation Objects
253
Function Operation Objects
254
7-8.Handling Exceptions in the Spring JDBC Framework
255
Problem
255
Solution
255
How It Works
256
Understanding Exception Handling in the Spring JDBC Framework
256
Customizing Data Access Exception Handling
259
7-9. Summary
260
CHAPTER 8 Transaction Management in Spring
262
8-1. Problems with TransactionManagement
263
Managing Transactions with JDBC Commit and Rollback
267
8-2. Choosing a TransactionManager Implementation
268
Problem
268
Solution
269
How It Works
269
8-3.Managing Transactions Programmatically with the Transaction Manager API
270
Problem
270
Solution
270
How It Works
270
8-4.Managing Transactions Programmatically with a Transaction Template
272
Problem
272
Solution
272
How It Works
272
8-5.Managing Transactions Declaratively with Classic Spring AOP
275
Problem
275
Solution
275
How It Works
276
8-6.Managing Transactions Declaratively with Transaction Advices
278
Problem
278
Solution
278
How It Works
278
8-7.Managing Transactions Declaratively with the @Transactional Annotation
280
Problem
280
Solution
280
How It Works
280
8-8. Setting the Propagation Transaction Attribute
281
Problem
281
Solution
281
How It Works
282
The REQUIRED Propagation Behavior
283
The REQUIRES_NEWPropagation Behavior
285
Setting the Propagation Attribute in Transaction Advices, Proxies, and APIs
285
8-9. Setting the Isolation Transaction Attribute
286
Problem
286
Solution
286
How It Works
287
The READ_UNCOMMITTED and READ_COMMITTED Isolation Levels
289
The REPEATABLE_READ Isolation Level
291
The SERIALIZABLE Isolation Level
293
Setting the Isolation Level Attribute in Transaction Advices, Proxies, and APIs
293
8-10. Setting the Rollback Transaction Attribute
294
Problem
294
Solution
294
How It Works
294
8-11. Setting the Timeout and Read-Only Transaction Attributes
295
Problem
295
Solution
296
How It Works
296
8-12.Managing Transactions with Load-TimeWeaving
297
Problem
297
Solution
297
How It Works
297
8-13. Summary
300
CHAPTER 9 Spring ORM Support
302
9-1. Problems with Using ORM Frameworks Directly
303
Persisting Objects Using the Hibernate API with Hibernate XML Mappings
304
Persisting Objects Using the Hibernate API with JPA Annotations
308
Persisting Objects Using JPA with Hibernate As the Engine
310
9-2. Configuring ORM Resource Factories in Spring
314
Problem
314
Solution
314
How It Works
314
Configuring a Hibernate Session Factory in Spring
314
Configuring a JPA EntityManager Factory in Spring
318
9-3. Persisting Objects with Spring’s ORMTemplates
321
Problem
321
Solution
321
How It Works
321
Using a Hibernate Template and a JPA Template
321
Extending the Hibernate and JPA DAO Support Classes
325
9-4. Persisting Objects with Hibernate’s Contextual Sessions
327
Problem
327
Solution
327
How It Works
327
9-5. Persisting Objects with JPA’s Context Injection
330
Problem
330
Solution
331
How It Works
331
9-6. Summary
334
CHAPTER 10 Spring MVC Framework
335
10-1.Developing a Simple Web Application with Spring MVC
335
Problem
335
Solution
336
How It Works
337
Setting Up a Spring MVC Application
339
Creating the Configuration Files
340
Creating Spring MVC Controllers
341
Creating JSP Views
345
Deploying the Web Application
346
10-2.Mapping Requests to Handlers
347
Problem
347
Solution
347
How It Works
347
Mapping Requests by Bean Names
347
Mapping Requests by Controller Class Names
348
Mapping Requests with Custom Mapping Definitions
349
Mapping Requests by Multiple Strategies
349
10-3. Intercepting Requests with Handler Interceptors
350
Problem
350
Solution
350
How It Works
351
10-4. Resolving User Locales
353
Problem
353
Solution
353
How It Works
354
Resolving Locales by an HTTP Request Header
354
Resolving Locales by a Session Attribute
354
Resolving Locales by a Cookie
354
Changing a User’s Locale
355
10-5. Externalizing Locale-Sensitive Text Messages
356
Problem
356
Solution
356
How It Works
356
10-6. Resolving Views by Names
357
Problem
357
Solution
357
How It Works
358
Resolving Views Based on URLs
358
Resolving Views from an XML Configuration File
358
Resolving Views from a Resource Bundle
359
Resolving Views with Multiple Resolvers
360
The Redirect Prefix
360
10-7.Mapping Exceptions to Views
360
Problem
360
Solution
361
How It Works
361
10-8. Constructing ModelAndView Objects
362
Problem
362
Solution
362
How It Works
363
10-9. Creating a Controller with a Parameterized View
365
Problem
365
Solution
365
How It Works
365
10-10.Handling Forms with Form Controllers
367
Problem
367
Solution
367
How It Works
367
Creating a Form Controller
368
Applying the Post/Redirect/Get Design Pattern
372
Initializing the Command Object
373
Providing Form Reference Data
375
Binding Properties of Custom Types
377
Validating Form Data
378
10-11.Handling Multipage Forms with Wizard Form Controllers
380
Problem
380
Solution
380
How It Works
381
Creating Wizard Form Pages
382
Creating a Wizard Form Controller
385
Validating Wizard FormData
387
10-12.Grouping Multiple Actions into a Controller
389
Problem
389
Solution
389
How It Works
389
Creating a Multi-Action Controller
391
Mapping URLs to Handler Methods
393
10-13. Creating Excel and PDF Views
395
Problem
395
Solution
395
How It Works
395
Creating Excel Views
397
Creating PDF Views
398
10-14.Developing Controllers with Annotations
399
Problem
399
Solution
399
How It Works
400
Developing Single-Action and Multi-Action Controllers
401
Developing a Form Controller
403
Comparison with the Traditional Controller Approach
406
10-15. Summary
407
CHAPTER 11 Integrating Spring with Other Web Frameworks
408
11-1. Accessing Spring in Generic Web Applications
408
Problem
408
Solution
409
How It Works
409
11-2. Integrating Spring with Struts 1.x
413
Problem
413
Solution
413
How It Works
414
Loading Spring’s Application Context into a Struts Application
415
Accessing Spring’s Application Context in Struts Actions
416
Declaring Struts Actions in Spring’s Bean Configuration File
418
11-3. Integrating Spring with JSF
420
Problem
420
Solution
420
How It Works
420
Resolving Spring Beans in JSF
423
Declaring JSF Managed Beans in Spring’s Bean Configuration File
424
11-4. Integrating Spring with DWR
425
Problem
425
Solution
425
How It Works
425
Exposing Spring Beans for Remote Invocation
427
Configuring DWR in Spring’s Bean Configuration File
428
11-5. Summary
429
CHAPTER 12 Spring Testing Support
430
12-1. Creating Tests with JUnit and TestNG
431
Problem
431
Solution
431
How It Works
431
Testing with JUnit 3.8
432
Testing with JUnit 4
433
Testing with TestNG
434
12-2. Creating Unit Tests and Integration Tests
436
Problem
436
Solution
436
How It Works
437
Creating Unit Tests for Isolated Classes
437
Creating Unit Tests for Dependent Classes Using Stubs and Mock Objects
441
Creating Integration Tests
445
12-3.Unit Testing Spring MVC Controllers
446
Problem
446
Solution
446
How It Works
446
Unit Testing Classic Spring MVC Controllers
446
Unit Testing Annotation-Based Spring MVC Controllers
449
12-4.Managing Application Contexts in Integration Tests
451
Problem
451
Solution
451
How It Works
452
Accessing the Context with JUnit 3.8 Legacy Support
452
Accessing the Context with the TestContext Framework in JUnit 4.4
453
Accessing the Context with the TestContext Framework in JUnit 3.8
455
Accessing the Context with the TestContext Framework in TestNG
456
12-5. Injecting Test Fixtures into Integration Tests
457
Problem
457
Solution
458
How It Works
458
Injecting Test Fixtures with JUnit 3.8 Legacy Support
458
Injecting Test Fixtures with the TestContext Framework in JUnit 4.4
459
Injecting Test Fixtures with the TestContext Framework in JUnit 3.8
460
Injecting Test Fixtures with the TestContext Framework in TestNG
461
12-6.Managing Transactions in Integration Tests
462
Problem
462
Solution
462
How It Works
463
Managing Transactions with JUnit 3.8 Legacy Support
464
Managing Transactions with the TestContext Framework in JUnit 4.4
465
Managing Transactions with the TestContext Framework in JUnit 3.8
467
Managing Transactions with the TestContext Framework in TestNG
467
12-7. Accessing a Database in Integration Tests
468
Problem
468
Solution
468
How It Works
468
Accessing a Database with JUnit 3.8 Legacy Support
468
Accessing a Database with the TestContext Framework
469
12-8.Using Spring’s Common Testing Annotations
472
Problem
472
Solution
472
How It Works
473
Using Common Testing Annotations with JUnit 3.8 Legacy Support
473
Using Common Testing Annotations with the TestContext Framework
473
12-9. Summary
474
PART 3 Advanced
476
CHAPTER 13 Spring Security
477
13-1. Securing URL Access
477
Problem
477
Solution
478
How It Works
478
Setting Up a Spring MVC Application That Uses Spring Security
480
Creating the Configuration Files
480
Creating the Controllers and Page Views
482
Securing URL Access
486
13-2. Logging In to Web Applications
488
Problem
488
Solution
488
How It Works
488
HTTP Basic Authentication
489
Form-Based Login
489
The Logout Service
491
Anonymous Login
492
Remember-Me Support
492
13-3. Authenticating Users
492
Problem
492
Solution
492
How It Works
493
Authenticating Users with In-Memory Definitions
493
Authenticating Users Against a Database
494
Encrypting Passwords
496
Authenticating Users Against an LDAP Repository
497
Caching User Details
501
13-4.Making Access Control Decisions
502
Problem
502
Solution
503
How It Works
503
13-5. Securing Method Invocations
506
Problem
506
Solution
506
How It Works
506
Securing Methods by Embedding a Security Interceptor
506
Securing Methods with Pointcuts
507
Securing Methods with Annotations
508
13-6.Handling Security in Views
509
Problem
509
Solution
509
How It Works
509
Displaying Authentication Information
509
Rendering View Contents Conditionally
510
13-7.Handling Domain Object Security
511
Problem
511
Solution
511
How It Works
512
Setting Up an ACL Service
512
Maintaining ACLs for Domain Objects
515
Making Access Control Decisions Based on ACLs
517
Handling Domain Objects Returned from Methods
520
13-8. Summary
521
CHAPTER 14 Spring Portlet MVC Framework
523
14-1.Developing a Simple Portlet with Spring Portlet MVC
523
Problem
523
Solution
523
How It Works
525
Setting Up a Portlet Application
525
Creating the Configuration Files
526
Creating Portlet Controllers
528
Mapping Portlet Requests to Handlers
529
Resolving View Names into Views
529
Creating Portlet Views
530
Deploying the Portlet Application
530
14-2.Mapping Portlet Requests to Handlers
531
Problem
531
Solution
532
How It Works
532
Mapping Requests by the Portlet Mode
534
Mapping Requests by a Parameter
538
Mapping Requests by Both the Portlet Mode and Parameter
540
14-3.Handling Portlet Forms with Simple Form Controllers
541
Problem
541
Solution
541
How It Works
541
Creating Form Controllers
543
Validating Form Data
547
14-4.Developing Portlet Controllers with Annotations
549
Problem
549
Solution
549
How It Works
549
Developing Multi-Action Controllers
549
Developing Form Controllers
552
14-5. Summary
555
CHAPTER 15 Spring Web Flow
556
15-1.Managing a Simple UI Flow with Spring Web Flow
556
Problem
556
Solution
556
How It Works
557
Setting Up a Spring MVC Application That Uses Spring Web Flow
558
Creating the Configuration Files
559
Creating Web Flow Definitions
561
15-2.Modeling Web Flows with Different State Types
563
Problem
563
Solution
564
How It Works
564
Defining View States
567
Defining Action States
571
Defining Decision States
572
Defining End States
573
Defining Subflow States
575
15-3. Securing Web Flows
576
Problem
576
Solution
576
How It Works
577
15-4. Persisting Objects in Web Flows
579
Problem
579
Solution
579
How It Works
579
Configuring JPA in Spring’s Application Context
580
Setting Up JPA for Spring Web Flow
581
Using JPA in Web Flows
582
15-5. Integrating Spring Web Flow with JSF
585
Problem
585
Solution
586
How It Works
586
Rendering JSF Views for Spring Web Flow
586
Using the JSF Components of Spring Faces
589
15-6. Summary
591
CHAPTER 16 Spring Remoting and Web Services
593
16-1. Exposing and Invoking Services Through RMI
594
Problem
594
Solution
594
How It Works
595
Exposing an RMI Service
596
Invoking an RMI Service
597
16-2. Exposing and Invoking Services Through HTTP
598
Problem
598
Solution
598
How It Works
599
Exposing a Hessian Service
599
Invoking a Hessian Service
601
Exposing a Burlap Service
601
Invoking a Burlap Service
601
Exposing an HTTP Invoker Service
602
Invoking an HTTP Invoker Service
602
16-3. Choosing aWeb Service Development Approach
602
Problem
602
Solution
602
How It Works
603
Contract-LastWeb Services
603
Contract-FirstWeb Services
603
Comparison
604
16-4. Exposing and InvokingWeb Services Using XFire
605
Problem
605
Solution
605
How It Works
605
Exposing aWeb Service Using XFire
605
Inspecting the GeneratedWSDL File
607
Invoking aWeb Service Using XFire
609
Exposing an Annotation-BasedWeb Service Using XFire
610
16-5.Defining the Contract ofWeb Services
611
Problem
611
Solution
611
How It Works
611
Creating Sample XMLMessages
611
Generating an XSD File from Sample XMLMessages
612
Optimizing the Generated XSD File
614
Previewing the GeneratedWSDL File
614
16-6. ImplementingWeb Services Using Spring-WS
615
Problem
615
Solution
615
How It Works
616
Setting Up a Spring-WS Application
616
MappingWeb Service Requests to Endpoints
618
Creating Service Endpoints
618
Publishing theWSDL File
620
16-7. InvokingWeb Services Using Spring-WS
622
Problem
622
Solution
622
How It Works
622
16-8.DevelopingWeb Services with XMLMarshalling
625
Problem
625
Solution
625
How It Works
626
Creating Service Endpoints with XMLMarshalling
626
InvokingWeb Services with XMLMarshalling
629
16-9. Creating Service Endpoints with Annotations
631
Problem
631
Solution
631
How It Works
631
16-10. Summary
632
CHAPTER 17 Spring Support for EJB and JMS
634
17-1. Creating EJB 2.x Components with Spring
634
Problem
634
Solution
635
How It Works
635
Creating EJB 2.x Components with Spring’s Support
638
17-2. Accessing EJB 2.x Components in Spring
640
Problem
640
Solution
641
How It Works
641
Accessing EJB 2.x Components Without Spring’s Support
642
Accessing EJB 2.x Components with Spring’s Support
644
17-3. Accessing EJB 3.0 Components in Spring
646
Problem
646
Solution
646
How It Works
646
Accessing EJB 3.0 Components Without Spring’s Support
647
Accessing EJB 3.0 Components with Spring’s Support
647
17-4. Sending and Receiving JMSMessages with Spring
649
Problem
649
Solution
649
How It Works
650
Sending and ReceivingMessages with Spring’s JMS Template
655
Sending and ReceivingMessages to and from a Default Destination
658
Extending the JmsGatewaySupport Class
660
Converting JMSMessages
661
Managing JMS Transactions
663
17-5. CreatingMessage-Driven POJOs in Spring
664
Problem
664
Solution
665
How It Works
665
Listening for JMSMessages withMessage Listeners
665
Listening for JMSMessages with POJOs
667
Converting JMSMessages
668
Managing JMS Transactions
669
Using Spring’s JMS Schema
669
17-6. Summary
670
CHAPTER 18 Spring Support for JMX, E-mail, and Scheduling
672
18-1. Exporting Spring Beans As JMX MBeans
672
Problem
672
Solution
673
How It Works
673
Registering MBeansWithout Spring’s Support
675
Exporting Spring Beans As MBeans
678
Exposing MBeans for Remote Access
679
Assembling theManagement Interface of MBeans
680
Auto-Detecting MBeans by Annotations
682
18-2. Publishing and Listening to JMX Notifications
684
Problem
684
Solution
684
How It Works
684
Publishing JMX Notifications
684
Listening to JMX Notifications
685
18-3. Accessing Remote JMX MBeans in Spring
686
Problem
686
Solution
686
How It Works
686
Accessing Remote MBeans Through an MBean Server Connection
686
Accessing Remote MBeans Through an MBean Proxy
688
18-4. Sending E-mail with Spring’s E-mail Support
689
Problem
689
Solution
689
How It Works
689
Sending E-mail Using the JavaMail API
691
Sending E-mail with Spring’sMailSender
692
Defining an E-mail Template
694
Sending MIMEMessages
695
18-5. Scheduling with Spring’s JDK Timer Support
697
Problem
697
Solution
697
How It Works
698
Creating a Timer Task
698
Using JDK Timer Without Spring’s Support
698
Using JDK Timer with Spring’s Support
699
18-6. Scheduling with Spring’s Quartz Support
700
Problem
700
Solution
700
How It Works
700
Using Quartz Without Spring’s Support
700
Using Quartz with Spring’s Support
702
18-7. Summary
705
CHAPTER 19 Scripting in Spring
706
19-1. Implementing Beans with Scripting Languages
706
Problem
706
Solution
706
How It Works
707
Scripting Beans with JRuby
707
Scripting Beans with Groovy
709
Scripting Beans with BeanShell
710
19-2. Injecting Spring Beans into Scripts
711
Problem
711
Solution
711
How It Works
711
Injecting Spring Beans into JRuby
712
Injecting Spring Beans into Groovy
713
Injecting Spring Beans into BeanShell
713
19-3. Refreshing Beans from Scripts
714
Problem
714
Solution
714
How It Works
714
19-4.Defining Script Sources Inline
715
Problem
715
Solution
715
How It Works
715
19-5. Summary
716
Index
718
Alle Preise verstehen sich inklusive der gesetzlichen MwSt.