spring in action 第四版 最新版 高清版
Spring in action FOURTH EDITION CRAIG WALLS MANNING SHELTER ISLAND For online information and ordering of this and other Manning books, please visit www.manning.com.Thepublisheroffersdiscountsonthisbookwhenorderedinquantity For more information, please contact Special sales Department Manning publications co 20 Baldwin road PO Box 761 Shelter island. ny11964 Emailorders@manning.com @2015 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 the designations 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 o Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper and we exert our best efforts to that end Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine Manning publications co Development editor: Cynthia Kane 20 Baldwin road Copveditor: Andy carroll Shelter island. ny11964 Proofreader: Alyson brener Typesetter: Dottie marsico Cover designer: Marija Tudor ISBN9781617291203 Printed in the united states of america 12345678910-EBM-191817161514 brief contents PART 1 CORE SPRING 1 into action 3 2■ Wiring beans32 g 3■ Advanced wiring64 4 Aspect-oriented Spring 97 PART 2 SPRING ON THE WEB 129 5 Building Spring web applications 131 6 Rendering web views 164 Advanced Spring mvc 1 g 94 8 Working with Spring web flow 219 Securing web applications 244 PART 3 SPRING IN THE BACK END 279 10 Hitting the database with spring and dbc 281 11 Persisting data with object-relational mapping 305 12 Worki oSQL databases 327 13 ing data 362 14 Securing methods 979 BRIEF CONTENTS PART 4 INTEGRATING SPRING e●●。。。●●。。●●●。。。●。。。@。●@●。。。。。●●。●。。 391 15 Working with remote services 393 6 Creating REST APIs with Spring MVC 416 17 Messaging in Spring 452 18 Messaging with WebSocket and SToMP 485 19 Sending email with Spring 51l 20 Managing Spring beans with JMX 523 21 Simplifying Spring development with Spring Boot 540 contents preface xvii acknowledgments xix about this book xxi PART I CORE SPRING Springing into action 3 1.1 Simplifying Java development 4 Unleashing the power of PojOs 5. Injecting dependencies 5 Applying aspects 11 Eliminating boilerplate code with templates 16 1.2 Containing your beans 18 Working with an application context 19. A bean's life 20 1. 8 Surveying the spring landscape 21 Spring modules 22. The spring portfolio 24 1.4 What's new in Spring 27 What was new in Spring 3. 1? 27. What was new in Spring 3.2? 28 What's new in spring 4.0? 29 1.5 Summary 30 CONTENTS Wiring beans 32 2.1 Exploring Springs configuration options 38 2.2 Automatically wiring beans 34 Creating discoverable beans 34 Naming a component-scanned bean 38 Setting a base package for component scanning 38 Annotating beans to be automatically wired 39: Verifying automatic configuration 41 2.3 Wiring beans with Java 43 Creating a configuration class 43 Declaring a simple bean 44 a Injecting with avaconfig 2.4 Wiring beans with XML 46 Creating an XML configuration specification 47 Declaring a simple 48. Initializing a bean with constructor injection 49 m Setting properties 54 2.5 Importing and mixing configurations 59 Referencing XML configuration in avaConfig 59 Referencing Java Config in XML configuration 61 2.6 Summary 63 2 Advanced wiring 64 3.1 Environments and profiles 64 Configuring profile beans 66 Activating profiles 70 3.2 Conditional beans 72 8.8 Addressing ambiguity in autowiring 75 Designating a primary bean 76. Qualifying autowired beans 3.4 Scoping beans 81 Working with request and session scope 82. Declaring scoped proxies in XML 84 3.5 Runtime value injection 84 Injecting external values 85 Wiring with the spring E epression language 89 3.6 Summary 95 Aspect-oriented Spring 97 4.1 What is aspect-oriented programming? 98 Defining AOP terminology 99. Spring's AOP support 101 CONTENTS 4. 2 Selecting join points with pointcuts 103 Writing pointcuts 104: Selecting beans in pointcuts 106 4.3 Creating annotated aspects 106 Defining an aspect 106 Creating around advice 110 Handling parameters in advice 112 Annotating introductions 115 4.4 Declaring aspects in XML 117 Declaring before and after advice 118 Declaring around advice 121 Passing parameters to advice 122 Introducing new functionality with aspects 124 4.5 Injecting Aspect] aspects 125 4.6 Summary 127 PART 2 SPRING ON THE WEB 129 Building Spring web applications 131 5.1 Getting started with Spring m g VC132 Following the life of a request 132. Setting up spri MVC 134: Introducing the spittr application 138 5.2 Writing a simple controller 139 Testing the controller 140- Defining class-level request handling 142. Passing model data to the view 143 5. 8 Accepting request input 148 Taking query parameters 149. Taking input via path parameters 151 5.4 Processing forms 154 Writing a form-handling controller 156. Validating forms 159 5.5 Summary 162 Rendering web views 164 6.1 Understanding view resolution 164 6.2 Creating isp views 167 Configuring a SP-ready view resolver 167. Using Spring's SP libraries 169 6. 3 Defining a layout with apache Tiles views 182 Configuring a Tiles view resolver 182
暂无评论