Maning in spring

Páginas: 105 (26148 palabras) Publicado: 15 de septiembre de 2012
SPRING
IN ACTION
Craig Walls
Ryan Breidenbach

MANNING

Spring in Action
CRAIG WALLS
RYAN BREIDENBACH

MANNING
Greenwich
(74° w. long.)

For online information and ordering of this and other Manning books, please go to
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact:
Special Sales Department
ManningPublications Co.
209 Bruce Park Avenue
Fax: (203) 661-9018
Greenwich, CT 06830
email: orders@manning.com
©2005 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by means electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.
Many of thedesignations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy
to have the books they publish printedon acid-free paper, and we exert our best efforts
to that end.

Manning Publications Co.
Copyeditor: Liz Welch
209 Bruce Park Avenue
Typesetter: Denis Dalinnik
Greenwich, CT 06830
Cover designer: Leslie Haimes

ISBN 1-932394-35-4
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – VHG – 09 08 07 06 05

Maisy Grace, see you soon
—C.W.

For my brother, Lee
—R.B. brief contents
PART 1 SPRING ESSENTIALS ........................................................ 1
1



A Spring jump start

2



Wiring beans

3



Creating aspects

3

42
91

PART 2 SPRING IN THE BUSINESS LAYER .............................. 131
4



Hitting the database

133

5



Managing transactions

6



Remoting

7



Accessingenterprise services

173

207
240

PART 3 SPRING IN THE WEB LAYER ....................................... 267
8



Building the web layer

9



View layer alternatives 319

10



Working with other web frameworks

11



Securing Spring applications 367

vii

269
346

contents
preface xvii
acknowledgments xx
about this book xxiii

PART 1 SPRING ESSENTIALS............................................... 1

1

A Spring jump start 3
1.1

Why Spring? 5
A day in the life of a J2EE developer

1.2

5



Spring’s pledge 6

What is Spring? 8
Spring modules

9

1.3

Spring jump start 12

1.4

Understanding inversion of control

15

Injecting dependencies 16 IoC in action
IoC in enterprise applications 23


1.5

16Applying aspect-oriented programming
Introducing AOP
enterprise 30

25

ix



AOP in action

27

25


AOP in the

x

CONTENTS

1.6

Spring alternatives 33
Comparing Spring to EJB 33 Considering other lightweight
containers 36 Web frameworks 38 Persistence
frameworks 40




1.7

2

Summary



40

Wiring beans 42
2.1

Containing your beans

44Introducing the BeanFactory 44
context 46 A bean’s life 47



Working with an application



2.2

Basic wiring 50
Wiring with XML 54 Adding a bean 55 Injecting
dependencies via setter methods 58 Injecting dependencies
via constructor 65






2.3

Autowiring

69

Handling ambiguities of autowiring 71 Mixing auto and
explicit wiring 72 Autowiring by default 72 Toautowire
or not to autowire 72




2.4



Working with Spring’s special beans

73

Postprocessing beans 74 Postprocessing the bean factory 76
Externalizing the configuration 78 Customizing property
editors 80 Resolving text messages 83 Listening for
events 85 Publishing events 86 Making beans aware 87










2.5

3

Summary



90

Creating aspects...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Springo
  • Spring
  • Spring seguridad
  • Spring rcp
  • Spring awakening
  • Appalachian Spring
  • Spring break
  • Spring Mvc

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS