CYAN MAGENTA YELLOW BLACK PANTONE 123 C Books for professionals by professionals ® The EXPERT’s VOIce ® in Open Source Core Core skills skills for for Companion eBook Available Pro Spring 2.5 Dear Readers, Aleksa Vukotic Anirvan Chakraborty Jessica Ditt When Rob Harrop and I wrote Pro Spring in 2005, we could see a distinct move from so-called heavyweight architectures, such as Enterprise JavaBeans™, toward lightweight frameworks, like Spring Since then, this trend has not stopped; in fact, it’s picked up pace The Spring Framework remains the leader in this move and provides a platform on which you can build your own applications and services This book covers the new features of Spring 2.5, but moreover, we focus on the best practices and core standards of contemporary Spring development As members of the Spring development team at Cake Solutions, we bring extensive practical experience gained from working with Spring since version 1.0 and delivering successful systems on top of it In this book, we show you the approaches that really matter in a professional, enterprise-level environment, so you can apply them to your projects today, safe in the knowledge that they just work We show you how to use Spring’s Inversion of Control (IoC) core to express the dependencies between your application’s components without having to write any Java™ code, as well as Spring's excellent aspect-oriented programming (AOP) support, including coverage of Spring 2.5’s new @AspectJ feature Other topics new to this edition are how to use Spring’s dynamic scripting language features, Spring design patterns, and performance tuning At each stage, we explain what works in real-world Spring development, giving you the skills you need to use Spring’s core to the best effect in your own applications We also step beyond the IoC and AOP core and describe Spring’s support for the JDBC™ framework, Hibernate, the Quartz enterprise scheduler, declarative transaction management, and much more Finally, we cover Spring’s well-designed MVC framework and adding AJAX to your Spring web applications, so that you will be able to create flexible, efficient, and manageable applications using the best techniques available Jan Machacek, Aleksa Vukotic, Anirvan Chakraborty, and Jessica Ditt Companion eBook See last page for details on $10 eBook version www.apress.com Beginning Spring Pro Spring 2.5 Pro Spring 2.5 The Spring Framework 2.5 release reflects the state of the art in both the Spring Framework and in enterprise Java™ frameworks as a whole A guidebook to this critical tool is necessary reading for any conscientious Java™ developer —Rob Harrop, author Pro Spring Pro Java EE Spring Patterns TM The Definitive Guide to Terracotta ISBN-13: 978-1-59059-921-1 ISBN-10: 1-59059-921-7 54999 US $49.99 Shelve in Java Programming User level: Intermediate–Advanced and and forward forward Expert Spring MVC and Web Flows 781590 599211 this print for content only—size & color not accurate Machacek, Vukotic, Chakraborty, Ditt SOURCE CODE ONLINE THE APRESS ROADMAP Pro Spring 2.5 Jan Machacek, author of Pro Visual Studio NET Oracle Application Server 10g: J2EE Deployment and Administration Pro Spring Spring 2, Spring Spring 2.5 2.5 Jan Machacek, Aleksa Vukotic, Anirvan Chakraborty, and Jessica Ditt Foreword by Rob Harrop, Principal Software Engineer and Lead Engineer of SpringSource Application Platform spine = 1.724" 920 page count 9217ch00FM.qxd 7/25/08 5:58 PM Page i Pro Spring 2.5 Jan Machacek, Aleksa Vukotic, Anirvan Chakraborty, and Jessica Ditt 9217ch00FM.qxd 7/30/08 3:54 PM Page ii Pro Spring 2.5 Copyright © 2008 by Jan Machacek, Aleksa Vukotic, Anirvan Chakraborty, and Jessica Ditt All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-13 (pbk): 978-1-59059-921-1 ISBN-10 (pbk): 1-59059-921-7 ISBN-13 (electronic): 978-1-4302-0506-7 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark SpringSource is the company behind Spring, the de facto standard in enterprise Java SpringSource is a leading provider of enterprise Java infrastructure software, and delivers enterprise class software, support and services to help organizations utilize Spring The open source–based Spring Portfolio is a comprehensive enterprise application framework designed on long-standing themes of simplicity and power With more than five million downloads to date, Spring has become an integral part of the enterprise application infrastructure at organizations worldwide For more information, visit www.springsource.com Lead Editors: Steve Anglin and Tom Welsh Technical Reviewer: Rick Evans Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Kevin Goff, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben RenowClarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Sofia Marchant Copy Editors: Heather Lang, Damon Larson Associate Production Director: Kari Brooks-Copony Production Editor: Kelly Winquist Compositor: Kinetic Publishing Services Proofreader: April Eddy Indexer: Broccoli Information Management Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use eBook versions and licenses are also available for most titles For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com You will need to answer questions pertaining to this book in order to successfully download the code 9217ch00FM.qxd 7/25/08 5:58 PM Page iii To Marc, who still thinks that beans grow on trees —Jan To my parents, Andja and Slobodan, who have guided me through life and encouraged me to follow my own path —Aleksa To my parents, Sujata and Kalyan, for their unconditional love and support —Anirvan To Ioannis, for the vital nudges when I needed them most (and so much more), and to my family, just for being my family —Jessica 9217ch00FM.qxd 7/25/08 5:58 PM Page iv Contents at a Glance Foreword xxi About the Authors xxiii About the Technical Reviewer xxiv Acknowledgments xxv Introduction xxvii PART Getting Started with Spring ■CHAPTER Introducing Spring ■CHAPTER Getting Started 13 ■CHAPTER Introducing Inversion of Control 31 ■CHAPTER Beyond the Basics 73 ■CHAPTER Introducing Spring AOP 147 ■CHAPTER Advanced AOP 199 ■CHAPTER Spring Schemas and Namespaces 259 ■CHAPTER Spring Patterns 279 PART ■■■ Data Access ■CHAPTER JDBC Support 319 ■CHAPTER 10 iBATIS Integration 373 ■CHAPTER 11 Hibernate Support 399 PART iv ■■■ ■■■ Enterprise Application Components ■CHAPTER 12 Job Scheduling with Spring 445 ■CHAPTER 13 Mail Support in Spring 477 ■CHAPTER 14 Dynamic Languages 511 9217ch00FM.qxd 7/25/08 5:58 PM PART ■■■ Page v Java EE ■CHAPTER 15 Using Spring Remoting 533 ■CHAPTER 16 Transaction Management 575 ■CHAPTER 17 Web Applications with Spring MVC 611 ■CHAPTER 18 Spring Web Flow 711 ■CHAPTER 19 Spring and AJAX 757 ■CHAPTER 20 JMX with Spring 771 ■CHAPTER 21 Testing with Spring 793 ■CHAPTER 22 Spring Performance Tuning 829 ■INDEX 857 v 9217ch00FM.qxd 7/25/08 5:58 PM Page vi 9217ch00FM.qxd 7/25/08 5:58 PM Page vii Contents Foreword xxi About the Authors xxiii About the Technical Reviewer xxiv Acknowledgments xxv Introduction xxvii PART ■CHAPTER ■■■ Getting Started with Spring Introducing Spring What Is Spring? Beyond Dependency Injection Aspect-Oriented Programming with Spring Accessing Data in Spring Simplifying and Integrating with Java EE Job Scheduling Support Mail Support Dynamic Languages Remoting Support Managing Transactions The Spring MVC Framework Spring Web Flow AJAX Internationalization Simplified Exception Handling The Spring Project 10 Origins of Spring 10 The Spring Community 10 Spring for Microsoft NET 10 The Spring IDE 11 The Spring Security (Formerly Acegi) 11 Alternatives to Spring 11 The Sample Code 12 Summary 12 vii 9217ch00FM.qxd viii 7/25/08 5:58 PM Page viii ■CONTENTS ■CHAPTER Getting Started 13 Obtaining the Spring Framework 13 Checking Out Spring from CVS 13 Building Spring from Source Code 14 Verifying Your Spring Distribution 15 Spring Packaging 15 Spring Dependencies 17 Spring Sample Applications 20 Setting Up Spring and Your IDE 21 Hello, World 24 Putting Spring Into “Hello, World” 27 Dependency Injection 28 The Impact of Spring 30 Summary 30 ■CHAPTER Introducing Inversion of Control 31 IoC and DI 31 Types of IoC 32 Contextualized Dependency Lookup 33 Constructor DI 35 Setter DI 36 Injection vs Lookup 37 Setter Injection vs Constructor Injection 38 IoC in Spring 39 DI with Spring 39 Beans and BeanFactories 40 BeanFactory Implementations 40 XML Bean Definition 41 Using Constructor Injection 43 Injection Parameters 46 Understanding Bean Naming 56 Bean Instantiation Modes 59 Resolving Dependencies 62 Automatically Wiring Your Beans 65 Checking Dependencies 68 Bean Inheritance 70 Summary 72 9217chIDX.qxd 876 7/25/08 5:45 PM Page 876 ■INDEX method injection lookup, 91–96 method replacement, 96–99 Method instance, 97 method parameter, 763 method-based mechanism, 75 MethodBeforeAdvice class, 156, 164 MethodExclusionMBeanInfoAssembler interface, 778 MethodInterceptor interface, 151, 164, 166 MethodInvocation object, 151, 164, 166 MethodInvocation.proceed( ) method, 151, 166 MethodInvoker*FactoryBean class, 471 MethodInvokingJobDetailFactoryBean class, 470 MethodInvokingTimerTaskFactoryBean class, 453, 470 MethodMatcher class, 170–171, 188, 190 MethodNameBasedMBeanInfoAssembler interface, 777–779, 781 MethodNameResolver class, 618–619, 621 methodNameResolver method, 618, 620, 691, 694, 702 MethodReplacer class, 96–97 Microsoft NET, 10–11 MIME messages with attachments, 491–492 complex, 497–499 HTML messages basic, 488–489 with embedded images, 489–491 with plain text alternative, 493–495 overview, 485–488 MimeBodyPart class, 495 MimeMessage class, 489, 493, 495 MimeMessageHelper class, 488–489, 493, 495, 498 MimeMessageHelper.addInline( ) method, 491 MimeMessageHelper.setText( ) method, 489 MimeMessagePreparator interface, 493–494 MimeMessagePreparator.prepare( ) method, 494 MimeMessage.setContent( ) method, 495 MimeMultipart class, 495, 498 minimumDiscount argument, 220 mix ins, 223–224 mix-in aspect, 224–225 mixin field, 224 MockFilterChain class, 800 MockFilterConfig class, 800 MockHttpServletRequest class, 800 MockHttpServletResponse class, 800 MockHttpSession class, 800 MockMultipartFile class, 800 MockMultipartHttpServletRequest class, 800 mocks, 795 MockServletContext class, 800 mode attribute, 595 model attribute, 732 model component, 611 Model conventions, 703–704 model data binding, 732–736 model MBeans, 772 ModelAndView class, 613, 616–627, 634, 643, 645, 648–650, 670, 675, 681, 688, 690, 693, 699–706, 741, 746, 851 ModelAndView view(HttpServletRequest request, HttpServletResponse response) method, 619 modelAttribute attribute, 657 ModelMap class, 703 model-view-controller (MVC) architecture, 611–612 command controllers AbstractWizardFormController class, 640–644 file upload, 644–646 form controllers, 633–640 overview, 633 controllers, 616–621 conventions over configuration, 701–705 handling exceptions, 647–650 implementation, 613–614 integration with Spring Web Flow, 746–747 interceptors, 621–622 locales, 630 localized messages, 629 overview, 8–9, 611, 613 themes, 630–632 using annotations for controller configuration, 705–709 using handler mappings, 614–615 views, 622–628 modifiers-pattern argument, 209 monitoring application health and performance, 853–855 mostComplexBean: SimplestBean method, 132 msg key, 135 MultiActionController class, 618–621, 627, 648, 670, 681, 690, 693, 702–703 multipart/alternative type, 495, 498 multipart/related type, 498 multipartResolver bean, 644, 646 MultipartResolver interface, 644 multiple error reporting, 298–301 mutate(BigDecimal) method, 579 MVC See model-view-controller MvcViewFactoryCreator class, 744, 747 MyConversionService class, 743 MyHelper instance, 91–92, 94 MySqlInsert class, 346 9217chIDX.qxd 7/25/08 5:45 PM Page 877 ■INDEX N name attribute, 50, 57–58, 618–622, 634–635, 637–638, 640–648, 651–654, 656–657, 660–661, 667–672, 676–677, 685–688, 697–698, 701–702 name bean, 211 name matching, 178–179 name property, 51–52, 71–72, 76–77, 400 name_ column, 412 Nameable interface, 89 NameMatchMethodPointcut class, 178, 181 NameMatchMethodPointcutAdvisor class, 181 nameMsg key, 135 NamespaceHandlerSupport class, 270 namespaceUri property, 551 NaN (Not a Number) function, 793 NanoContainer class, 11–12 NativeJdbcExtractor interface, 358, 360 nestedPath tag, 651, 654 NestedRuntimeException subclass, 138 NET project, 10–11 new operator, 100 newFixedThreadPool( ) method, 472 newRowMapper(Object[], Map) method, 353 no specific value (?) character, 461 nonstatic initialization method, 78 nontransactional code, 580–588 noOfTimes argument, 165 normalCall method, 239 normalCalls field, 224, 238 noRollbackFor attribute, 596, 599 Not a Number (NaN) function, 793 not null column, 400 Notificaiton.setUserData( ) method, 792 NotificationListener implementations, 788 NotificationPublisher interface, 790 NotificationPublisherAware interface, 790 notifications, JMX, 787–792 nth day (#) character, 462 nullPointerErrorView view, 648 NullPointerException instance, 36–37, 217–218, 235, 312, 649 O Object argument, 219, 232 object equality, 416–419 Object execute(CallableStatementCreator, CallableStatementCallback) method, 331 Object execute(ConnectionCallback) method, 330 Object execute(HibernateCallback action) method, 292 Object execute(PreparedStatementCreator, PreparedStatementCallback) method, 331 Object execute(StatementCallback) method, 331 Object execute(String, CallableStatementCallback3) method, 331 Object execute(String, PreparedStatementCallback) method, 331 Object Graph Navigation Language (OGNL), 727 Object mapRow(ResultSet rs, int rowNum) method, 357 object names, controlling, 776–777 Object query(PreparedStatementCreator, PreparedStatementSetter, ResultSetExtractor) method, 335 Object query(PreparedStatementCreator, ResultSetExtractor) method, 335 Object query(String, Object[], int[], ResultSetExtractor) method, 335 Object query(String, Object[], ResultSetExtractor) method, 336 Object query(String, PreparedStatementSetter, ResultSetExtractor) method, 335 Object query(String, ResultSetExtractor) method, 335 Object Request Broker (ORB), 540, 542–543 Object type, 101 Object[] array argument, 136 ObjectName bean:name=springManagedBean proxy, 787 ObjectName unique identifier, 772 ObjectNamingStrategy interface, 776 object-oriented programming (OOP), 147 object-relational mapping (ORM) tool, 373, 399, 830 objects mode, 69 ObscenityRemovingBeanFactoryPostProcessor bean, 110 Observer pattern, 290 OC4JLoadTimeWeaver implementation, 254 OGNL (Object Graph Navigation Language), 727 on delete cascade operation, 394 one-off trigger, 446 one-to-many selects, 388–390 one-to-one selects, 384–388 onInit( ) method, 546 onSubmit( ) method, 633–634, 646 OOP (object-oriented programming), 147 open MBeans, 771 OpenSymphony Quartz job scheduling engine arbitrary jobs, 470 creating simple jobs, 455–457 877 9217chIDX.qxd 878 7/25/08 5:45 PM Page 878 ■INDEX CronTrigger class, 460–464 Job persistence, 464 JobDataMaps class, 457–460 overview, 455 persistent jobs, 467–470 process, 465–467 option tag, 665–666 options tag, 666 oracle bean, 42, 48–49 Oracle interface, 38, 40, 42 oracle.jdbc.driver.OracleClobInputStream method, 361 OracleLobHandler class, 358, 360 ORB (Object Request Broker), 540, 542–543 order attribute, 595 Order object, 388–390, 393 order property, 614 orderCancelled event, 737 orderConfirmed event, 737 OrderDao interface, 389, 795 Ordered interface, 614, 616 orderItemList object, 704 orderItems object, 703–704 OrderLine object, 388–390, 393 OrderLineDao.save(OrderLine) method, 393 orderLines List property, 389 org.aopalliance.intercept.MethodInterceptor interface, 154 org.apache.axis.client.ServiceFactory class, 550, 555 org.codehaus.xfire.spring.remoting XFireExporter class, 558 org.springframework.aop AfterReturningAdvice interface, 154 org.springframework.aop AnnotationMatchingPointcut implementation, 172 org.springframework.aop AspectJExpressionPointcut implementation, 172 org.springframework.aop DynamicMethodMatcherPointcut implementation, 172 org.springframework.aop IntroductionInterceptor interface, 154 org.springframework.aop.MethodBeforeAdvice interface, 153 org.springframework.aop StaticMethodMatcherPointcut implementation, 172 org.springframework.aop.support package, 182 org.springframework.aop.support ComposablePointcut implementation, 172 org.springframework.aop.support ControlFlowPointcut implementation, 172 org.springframework.aop.support JdkRegexpMethodPointcut implementation, 172 org.springframework.aop.support NameMatchMethodPointcut implementation, 172 org.springframework.aop.support Pointcuts class, 190 org.springframework.aop.ThrowsAdvice interface, 154 org.springframework.binding2.0.0.RELEASE.jar file, 718 org.springframework.faces2.0.0.RELEASE.jar file, 718 org.springframework.jmx.support package, 785 org.springframework.js-2.0.0.RELEASE.jar file, 718 org.springframework.mock.jndi package, 817 org.springframework.mock.web package, 798 org.springframework.orm.hibernate3 classes, 401 org.springframework.remoting.jaxws JaxWsPortProxyFactoryBean, 559 org.springframework.test.context package, 819 org.springframework.validation.DataBinder class, 636 org.springframework.webflow2.0.0.RELEASE.jar file, 718 org.springframework.webflow.test.execution AbstractXmlFlowExecutionTests file, 753 org.springframework.web.servlet.handler SimpleMappingExceptionResolver resolver, 647 org.springframework.web.servlet.view.freem arker package, 675 ORM (object-relational mapping) tool, 373, 399, 830 OutOfMemoryError errors, 192 element, 737 output.txt file, 624 P p namespace, 47 p_actstartled function, 326, 349–350 packaging, 15–16, 281–282, 400–401 _page parameter, 640–642 pages property, 642–644, 709 tag, 548 parameterClass method, 383 parameterizableIndexController bean, 618 9217chIDX.qxd 7/25/08 5:45 PM Page 879 ■INDEX ParameterizableViewController class, 617–618 ParameterizedBeanPropertyRowMapper class, 353–354 ParameterizedBeanPropertyRowMapper( ) method, 355, 367 ParameterizedBeanPropertyRowMapper newInstance() method, 355 ParameterizedRowMapper class, 354 ParameterMethodNameResolver implementation, 619–620 paramName property, 620 parent attribute, 71 parent bean, 71–72 partial rendering of views, 736 PassThroughFilterChain class, 800 password property, 104, 106, 570–572 password tag, 664 path attribute, 625, 627, 634, 638, 640–641, 646, 654, 657–669, 687, 709 PATH environment variable, 249 paths[] array, 806 PatternEditor implementation, 113 pauseJob( ) method, 457 PDF views, 680–682 pdfReportHandler( ) method, 699 PeformanceAndHealthCollectingAspect class, 256 performance caching, 849–851 Enterprise application, 830 Java EE application data access tier, 837–847 determining necessary data sets, 837 identifying tuning needs, 830–837 overview, 830 remote calls, 849 transaction management, 847–849 views, 849 monitoring, 255–257, 853–855 overview, 829 resources on, 855 versus responsiveness, 829 testing, 793, 851–853 PerformanceMonitor class, 257 Perl5RegexpMethodPointcut pointcut, 179 pertarget expression, 228 perthis expression, 228 PetClinic application, 20 PetPortal application, 20 PicoContainer DI container, 11 pjp argument, 220, 237 plainTextView bean, 624 PlainTextView instance, 622–625 PlatformTransactionManager interface, 419, 575–576, 579, 588–591 PlatformTransactionManager.commit method, 589 PlatformTransactionManager.getTransaction( ) method, 576, 589 PlatformTransactionManager.rollback method, 589 poi dependency, 19 pointcut attribute, 232 pointcut expressions, 207–211 Pointcut implementation, 171–172, 181 Pointcut interface AnnotationMatchingPointcut class, 183–186 AspectJExpressionPointcut class, 182–183 ComposablePointcut class, 190 control flow pointcuts, 186–187 convenience advisor implementations, 181–182 DefaultPointcutAdvisor class, 172 DynamicMethodMatcherPointcut class, 175–177 implementations, 171–172 name matching, 178–179 overview, 170–171 regular expressions, 179–181 StaticMethodMatcherPointcut class, 172–175 pointcut( ) property, 217, 593 PointcutAdvisor interface, 152 PointcutAdvisor.getPointcut( ) method, 191 Pointcut.getClassFilter( ) method, 170 pointcut-ref attribute, 231–232, 240 pointcuts See also Pointcut interface @Pointcut annotation, 203–207 in aop namespace, 230–231 ComposablePointcut class, 187–190 overview, 169–170 Pointcuts.serviceExecution( ) @pointcut, 231 POJO model, 849 Pollack, Mark, 10 populateProtectedVariables property, 810 portInterface property, 550 portlets, 613 portName property, 550–551, 555, 559–560 POST request, 712, 726, 753 postProcessAfterInitialization method, 118, 123 postProcessBeanFactory bean, 106, 108 postProcessBeforeInitialization bean, 118, 122–123 postProcessJaxRpcService( ) method, 555 predictBeanType method, 124 PreferencesPlaceholderConfigurer postprocessor, 104 prefix attribute, 655 prefix property, 248 preInstantiateSingletons( ) method, 90, 125, 127–128 prepare( ) method, 495, 498 prepareCall method, 326–327 879 9217chIDX.qxd 880 7/25/08 5:45 PM Page 880 ■INDEX PreparedStatement class, 320, 323–326, 328, 331, 337, 343, 358 PreparedStatementCreator instance, 337, 343 PreparedStatementCreator createPreparedStatement(Connection) method, 331, 335 PreparedStatementSetter interface, 337 prepareMimeMessage( ) method, 509 presentation layer, 294, 612 primary key, 400 PrintStream argument, 25 private @pointcuts, 208 ProceedingJoinPoint argument, 219–221, 237 processFinish( ) method, 633, 642–644 Product class, 640, 696, 703 /product/a.html path, 620 ProductController class, 619–621, 627, 670, 674–675, 680–681, 699, 704 ProductController.handleIndex( ) method, 634 ProductController.index( ) method, 683 ProductController.view( ) method, 681 product-edit view, 672 product/edit.html page, 639 productFormController bean, 635 ProductFormController implementation, 634–637, 639, 672–673, 708 productId request parameter, 709 ProductImageForm class, 644–645 ProductImageFormController class, 644–645, 798 product/index directory, 614–615, 618, 622, 635, 670, 672, 675, 680, 692 product-index view, 627, 670, 683 /product/index.html page, 696 ProductPdfView class, 680–681 ProductsExcelView class, 682–684 products-index-r view, 634 ProductsXsltView class, 678–680 productValidator bean, 637, 644 ProductValidator class, 637–638, 667–668 /product/view.html path, 621 ProfilingExample class, 166 ProfilingInterceptor class, 165 programmatic transaction management, 588–591 ProgrammaticTxBankService interface, 588–590 programming against interfaces, 282 propagation attribute, 596, 599 PROPAGATION_DEFAULT propagation level, 597–598 PROPAGATION_REQUIRED propagation level, 598 properties file, 27 Properties instance, 52, 479 tag, 479 PropertiesBeanDefinitionReader interface, 40 PropertiesEditor implementation, 113 PropertiesMethodNameResolver implementation, 619–621, 691, 695 tag, 46–47, 49, 51, 70 PropertyConfigurerDemo class, 105 PropertyEditor interface, 73, 110–118, 521, 636 propertyEditor property, 654 PropertyEditorBean interface, 112 PropertyEditorRegistrar interface, 116 PropertyEditorRegistrar.registerCustomEditors method, 116 PropertyEditorSupport class, 113 PropertyOverrideConfigurer class, 116 PropertyOverrideConfigurer post-processor, 104 PropertyPlaceholderConfigurer class, 104–105, 116 props tag, 52, 55 protected abstract void doInTransactionWithoutResult method, 590 protected ModelAndView handleRequestInternal (HttpServletRequest request, HttpServletResponse response) method, 746 prototype bean, 228 prototype mode, 60 Prototype pattern, 284 prototype scope, 94 prototypeMe bean, 61 proxies accessing HTTP Invoker services using, 567 accessing RMI services using, 538–540 accessing RPC-style services using, 549–552 CGLIB, 192–193 choosing type of, 196 comparing performance of, 193–196 impact of, 242–246 JDK dynamic, 192 overview, 191–192, 241–242 using in transaction management, 593–594 Proxy class, 191, 287 ProxyFactory class, 151–154, 191, 196, 244 ProxyFactory( ) method, 153 ProxyFactory.addAdvice( ) method, 169 ProxyFactoryBean class, 152 ProxyFactory.setExposeProxy( ) method, 192 proxyInterface property, 787 proxyReference.getStockLevel( ) method, 244 proxy-target-class attribute, 595 public @pointcut, 208 9217chIDX.qxd 7/25/08 5:45 PM Page 881 ■INDEX public Collection populateProductTypes( ) method, 709 public ModelAndView foo(HttpServletRequest, HttpServletResponse) method, 620 public ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) method, 746 public ModelAndView viewHandler( ) method, 620 public ModelAndView view(HttpServletRequest, HttpServletResponse) method, 621 public ModelAndView view-product( ) method, 619 public ModelAndView(HttpServletRequest, HttpServletResponse) method, 618 public static Aspect aspectOf( ) method, 249 public String showForm( ) method, 709 public String submit( ) method, 709 public void after(UserService target) method, 236 publicUrlMapping bean, 615, 618, 690–691 publish( ) method, 143 publishing notifications, 788–792 Q qname attribute, 554 Quartz See OpenSymphony Quartz job scheduling engine Quartz scheduler, 308 QuartzSchedulerManage class, 305 query method, 334, 337–338, 367 queryForInt method, 339, 365 queryForList method, 339 queryForLong method, 339, 365 queryForMap method, 339, 365 queryForObject( ) method, 339, 365, 382 queryForRowSet method, 339 Quest JProbe measurement tool, 830 R radiobuttons tag, 662–664 RAMJobStore implementation, 464 RandomCustomerScoringService bean, 528 range (-) character, 461 rc_customer_type key, 369 RdbmsOperation class, 329 BatchSqlUpdate subclass, 348–349 JdbcTemplate class versus, 358 overview, 342 SqlCall class, 349–351 SqlQuery class, 351–358 SqlUpdate class, 343–348 StoredProcedure class, 349–351 READ_COMMITTED isolation level, 598, 847–848 readme.txt file, 717 readOnly attribute, 596 read-only attribute, 599 ref attribute, 48–49, 51 ref parent=“ ”/ tag, 51 ref parent=“name” tag, 52 ref tag, 48, 55 referenceData( ) method, 678 ReflectiveLoadTimeWeaver implementation, 254 refreshable beans, 521–523 refresh-check-delay attribute, 521, 523 regex type, 131 regexp dependency, 19 registerCustomEditors method, 116 registerDefaultFormatters method, 744 REGISTRATION_FAIL_ON_EXISTING registration, 776 REGISTRATION_IGNORE_EXISTING registration, 776 REGISTRATION_REPLACE_EXISTING registration, 776 registrationBehaviorName property, 776 registrationController bean, 644 registryPort property, 537 reimplement( ) method, 97 release-2-5-1 tag, 14 ReloadableResourceBundleMessageSource interface, 629 ReloadableResourceMessageSource interface, 134 remote access mechanisms, remote calls, 849 Remote interface, 536 remote MBeans, 785–786 Remote Method Invocation (RMI) accessing CORBA services, 543–544 accessing services using proxies, 538–540 exposing arbitrary services, 536–538 exposing CORBA services, 540–543 overview, 535 RemoteException class, 536, 538, 540 RemoteHelloWorld class, 540–541, 543, 545–547, 550–552, 557–559, 561 _RemoteHelloWorld_stub class, 541 RemoteHelloWorld.getMessage( ) method, 543, 552 remoting JMX, 785–787 element, 736 render(Map, HttpServletRequest, HttpServletResponse) method, 622 REPEAT_INDEFINITELY constant, 457 replaced-method tag, 97 replacementTarget bean, 98–99 ReplacementTarget class, 97–98 881 9217chIDX.qxd 882 7/25/08 5:45 PM Page 882 ■INDEX replacementTargetBean interface, 97 replacer attribute, 98 report.jrxml file, 697 request mode, 60 requestContext property, 728 requestParameters class, 728 requestScope class, 728 RequestToViewNameTranslator interface, 704–705 required attribute, 707 REQUIRES_NEW transaction propagation, 433 requiresSession property, 617 resolveTemplateName( ) method, 505 Resource interface, 28, 144, 521 ResourceBundle class, 133 resourceBundle variable, 730 ResourceBundleMessageSource interface, 134–135, 629–630, 637, 651 ResourceBundleViewResolver implementation, 625–626, 630, 632, 698 ResourceLoader interface, 144 ResourceLoaders method, 376 resources subdirectories, 22, 280 responsiveness, 829 result attribute, 727 resultMap element, 377–378, 381–383, 385–386, 388–390, 398 ResultSearchArgument class, 297 ResultSearchResult class, 297 ResultService class, 296 ResultSetExtractor interface, 337 ResultSetExtractor.extractData method, 334 ResultSupport subclass, 298, 436 ResultSupportT subclass, 437 result-type attribute, 728 resumeExecution method, 741, 746 resumeFlow method, 754 returning( ) property, 216–217, 232, 235 returningResultSet(String parameterName, ParameterizedRowMapper rowMapper) method, 368 RMI See Remote Method Invocation RmiProxyFactoryBean class, 539, 551 RmiServiceExporter class, 536–538, 565 Role object, 390 ROLE_ADMIN authority, 750 ROLE_USER authority, 750 rollback( ) method, 601 rollbackFor attribute, 596, 599 root attribute, 687 root tile definition, 695 root.jsp page, 686, 688 RowCallbackHandler class, 334, 337 RowMapper interface, 337, 353–354 RowMapper.mapRow method, 334 run( ) method, 36, 86, 88, 187, 287, 334, 447, 483–484 Runnable interface, 86 Runtime instance, 90 Runtime.addShutdownHook( ) method, 86 RuntimeException interface, 214, 588, 590 Runtime.getRuntime( ) method, 87 S s_customer_id sequence, 325 s_log_entry_id sequence, 400 SampleBean class, 182, 185 SampleServiceDemo class, 421 sandbox, 14 save( ) operation, 393 schedule( ) function, 445, 447–448 scheduleAtFixedRate( ) method, 447 ScheduledTimerTask class, 449–451, 453 Scheduler class, 456, 466 SchedulerFactoryBean class, 307, 466 schedulerFactoryClass property, 466 Scheduler.getJobDetail( ) method, 469 SchedulerManager interface, 305 Scheduler.pauseJobGroup( ) method, 457 scheduling support, schemas aop, 266 beans, 262 context, 263 custom, 270–274 handling of, 268–270 IDE configuration, 274–276 jee, 267 lang, 267 new configurations, 259–261 overview, 259–262 tx, 266 util, 263–265 scope attribute, 652–653, 655 scoped-proxy attribute, 133 scope-resolver attribute, 133 ScopeResolver interface, 133 scopes conversationScope variable, 729–731 flashScope varible, 728–729 flowScope variable, 729 requestParameters variable, 728 requestScope variable, 728 viewScope variable, 728 script tag, 764 ScriptFactory bean, 518 ScriptFactoryPostProcessor interface, 120, 123, 518 script-interfaces attribute, 523, 525–526, 529 scriptSource argument, 518 script-source attribute, 521 SearchArgumentSupport subclass, 436 9217chIDX.qxd 7/25/08 5:45 PM Page 883 ■INDEX SearchResultSupport subclass, 436 SecureBean class, 156, 159–160 SecureBean.writeSecureMessage( ) method, 160 element, 750 security authentication and authorization, 748–750 defining rules in flow definitions, 750–752 overview, 747–748 SecurityFlowExecutionListener class, 748 SecurityAdvice class, 159–160 element, 748 element, 570 element, 749 SecurityFlowExecutionListener class, 748 element, 749 element, 749–750 SecurityManager class, 157 SecurityManager instance, 159 SecurityManager.getLoggedOnUser( ) method, 158 element, 749 select * from t_supplier command, 845 select keyword, 357 select node, 381 select s_customer_id.nextval from dual statement, 394 select statement, 433 select tag, 664–665 SelectCustomerById class, 363 selectKey element, 395 selects many-to-many, 390 one-to-many, 388–390 one-to-one, 384–388 overview, 380 simple, 380–384 send( ) method, 480, 494 sender bean, 487 send(MailMessage) method, 38 sendMessage( ) method, 480, 491 sequence value, 396 SERIALIZABLE isolation level, 848 SerializedFlowExecutionSnapshotFactory property, 745 SerializerFactory interface, 553–554 server property, 774, 787 server-config.wsdd file, 547 serverConnector references, 786 service bean, 29 service property, 294, 537, 565 tag, 547, 553 serviceBean property, 559 service-cache-context.xml configuration file, 850 serviceCall( ) method, 224 service-context.xml configuration file, 848 serviceExecution @pointcut, 209 serviceExporter bean, 537, 542 serviceFactoryClass class, 550, 555 serviceInterface property, 537, 539, 550, 555, 559–560 serviceName property, 537, 550–551, 555–557, 559 servicePort property, 537 services package, 214, 233 services-context.xml file, 430 serviceUrl property, 539, 786 -servlet.xml, 565 ServletContextPropertyPlaceholderConfigurer post-processor, 104 ServletEndpoint class, 547 ServletEndpointSupport class, 535, 544–549, 551 servletErrorView view, 648 servlets, 613 session argument, 406 Session class, 401, 409–413 session mode, 60 SessionBindingConversationManager property, 745 session.close( ) method, 404 session.delete( ) method, 400 SessionFactory interface, 410 SessionFactory.getCurrentSession method, 410 session.flush( ) method, 441 sessionForm property, 643 session.get(Class, Serializable) method, 400 session.load(Class, Serializable) method, 400 SessionLocaleResolver implementation, 630 session.saveOrUpdate( ) method, 441 session.saveOrUpdate(Object) method, 400 SessionThemeResolver implementation, 632 set method, 209 Set object, 424 set tag, 52 Set categories property, 659, 661 setApplicationContext( ) method, 127 setAsText( ) method, 113 setAuthenticationPreemptive( ) method, 572 setBeanFactory(BeanFactory) method, 89 setBeanName(String) method, 87 setCategories, 302 setClob(int, Clob) method, 358 setComplete( ) method, 813 setContent( ) method, 495 setCurrentState method, 754 setDataHandler( ) method, 498 setDirty( ) method, 811, 815 883 9217chIDX.qxd 884 7/25/08 5:46 PM Page 884 ■INDEX setEncyclopedia(Encyclopedia) method, 49 setEncylopedia( ) method, 38 setFirstResult(int) method, 435 setFormView( ) method, 634 setGeneratedKeyColumnNames method, 346 setHeadline method, 302 setHost( ) method, 481 setId(long) method, 392 setLong method, 325 setMaxResults(int) method, 435 setMaxRowsAffected(int) method, 348 setName( ) method, 89, 183 setNull method, 325 setOptimize( ) method, 196 setProperty( ) method, 778 setProxyInterfaces( ) class, 192 setReturnGeneratedKeys method, 346 setRollbackOnly( ) method, 578 setSmtpHost(String) method, 38 setSmtpPassword(String) method, 38 setSmtpUsername(String) method, 38 setString method, 325 setTarget( ) method, 151, 153 setter injection, 36–39, 75 SetterMethodMatcher class, 190 setText( ) method, 495 setValue[s]( ) function, 768 Shared class, 62 shop flow, 737 short alias, 378 show_sql function, 833 showErrors macro, 677 showPage.jsp file, 724 showPassword attribute, 664 shutdown hook, 86–87 shutdown( ) method, 472 shutdownHook bean, 128 ShutdownHookBean interface, 90, 127 simple bean, 206, 211 simple class, 69, 186 simple2 bean, 78 simple3 bean, 77 SimpleAdvice class, 174 SimpleAfterAdvice class, 182 SimpleAfterReturningAdvice class, 161 SimpleAnnotation class, 184 SimpleAsyncTaskExecutor implementation, 473 simpleBean bean, 119 SimpleBean class, 71, 106, 121, 205–207, 210, 212 simpleBean method, 120 SimpleBeanDemo class, 77 SimpleBeanIB class, 79 SimpleBean.sayHello( ) method, 206 SimpleBeforeAdvice class, 155–156, 161, 186 SimpleControllerHandlerAdapter interface, 616, 722 SimpleDynamicPointcut class, 175 SimpleFormController implementation, 633–634, 636, 639, 644–645, 661, 663 SimpleHandlerMapping bean, 703 SimpleHelloWorld class, 536, 539, 547, 564 SimpleHtmlMessageSender class, 488 SimpleJaxWsServiceExporter class, 556–557 SimpleJdbcCall class, 364, 367–369 SimpleJdbcDaoSupport class, 364, 370–371 SimpleJdbcInsert class, 364, 369–370 SimpleJdbcTemplate class, 364–367, 582 SimpleLoadTimeWeaver implementation, 254 SimpleMailMessage class, 479–480, 482–486, 488 SimpleMailSender class, 480 SimpleMain class, 773 SimpleNamingContext class, 817 SimpleNamingContextBuilder class, 817–818 SimpleNativeJdbcExtractor extractor, 359 SimpleReflectiveMBeanInfoAssembler interface, 777 SimpleRemoteHelloWorld class, 540–543, 545–546 _SimpleRemoteHelloWorld_Tie class, 541 SimpleServerBean interface, 785 simple-servlet.xml file, 721–722 SimpleSpringBean interface, 781, 791 SimpleStaticPointcut class, 173–174 simplestBean bean, 130 SimpleThreadPoolTaskExecutor implementation, 473 SimpleThrowsAdvice class, 168 SimpleTrigger class, 457, 460, 462 SimpleUrlHandlerMapping implementation, 614–615, 618, 622, 635, 643, 648, 691, 722 SingleConnectionDataSource class, 468 singleMe bean, 61 Singleton class, 59 singleton mode, 60 Singleton pattern, 283 sku argument, 217 SmartInstantiationAwareBeanPostProcessor subinterface, 124 someJob( ) method, 453 someOperation( ) method, 88, 92–93 someValue method, 790 source code, 14–15, 24, 29 Spring, 279–315 accessing data in, 6–7 AJAX, alternatives to, 11–12 AOP, application patterns background processes, 304–309 e-mail notifications, 309–311 error collecting and logging, 311–315 high-performance paging, 295–298 9217chIDX.qxd 7/25/08 5:46 PM Page 885 ■INDEX layered design, 294–295 multiple error reporting, 298–301 overview, 293 user interface transactions, 301–304 building from source code, 14–15 community, 10 Countries application, 21 CVS, 13–14 dependencies, 17–20 design patterns behavioral patterns, 290–291 creational patterns, 283–287 overview, 282 programming against interfaces, 282 structural patterns, 287–289 Template Method, 292–293 DI, directory structure, 279–282 dynamic languages, exception handling, 9–10 exposing services to CORBA using, 541–542 IDE, 11, 21–23 ImageDB application, 21 internationalization, IoC, 39 J2EE, JasperRepots application, 21 JCA-10 application, 21 jPetStore Application, 20–21 mail support, 7–8 for Microsoft NET, 10–11 MVC framework, 8–9 origins of, 10 overview, 3–6, 10, 13, 279 packaging, 15–16 PetClinic application, 20 PetPortal application, 20 remoting support, scheduling support, Spring Security module, 11 Tiles example application, 21 transactions, verifying distribution, 15 Spring Modules project, 374 Spring Remoting architecture of, 535 choosing remoting architecture, 573 HTTP Invoker, 563–573 JAX-RPC, 544–556 JAX-WS, 556–563 overview, 533–535 RMI, 535–544 Spring Security module, 11, 13 Spring TestContext Framework See TestContext Framework Spring Web Flow See Web Flow spring-agent.jar library, 253 spring-aop.jar file, 16 SpringBean class, 770, 783 spring-beans.jar file, 16 spring-cciblackbox-tx.rar directory, 21 spring-context.jar file, 16 spring-context-support.jar file, 16 spring-core.jar file, 16 spring-form tags, 733 spring.ftl file, 675–677 spring-hibernate2.jar package, 401 spring.jar directory, 15 spring.jar distribution file, 675 spring.jar library, 16, 22 spring.jar package, 401 spring-jdbc.jar file, 16 spring-jms.jar file, 16 springManagedMBean bean, 774 tag, 141 spring-mvc-*.jar files, 16 spring-orm.jar file, 16 spring-test.jar file, 16 spring-tx.jar file, 16 spring-webflow subdirectory, 717 spring-web.jar file, 16 spring-webmvc.jar file, 16 spring-webmvc-portlet.jar file, 16 spring-webmvc-struts.jar file, 16 spring-with-dependencies distribution, 479 SqlCall class, 349–351 SqlCall hierarchy, 342 SQLException class, 328 SqlFunction class, 349, 357 sqlMap file, 375–378, 380–383, 385–393, 395–398 sqlMapClient bean, 375, 380 SqlMapClientCustomerDao implementation, 379 SqlMapConfig file, 381 sqlMapConfig.xml file, 375 SqlOperation hierarchy, 342 SqlParameterSource class, 365, 367 SqlQuery class, 342, 351–358 SqlUpdate class, 343–349 SqlUpdate subclass, 342, 350 sqrt( ) method, 794 src attribute, 491 src directory, 22, 280 stale data updates, 413–416 StaleObjectStateException statement, 416 stand-alone mode, 21 standard MBeans, 771 standardFoo bean, 59 StandardFoo implementation, 59 standardLookupBean bean, 93–94 StandardLookupDemoBean class, 92 standardTarget bean, 98–99 start( ) method, 456 885 9217chIDX.qxd 886 7/25/08 5:46 PM Page 886 ■INDEX start state, 735, 737 StartsTransaction @interface, 211 State diagrams, 714 stateful navigational control, 753 StatefulJob interface, 464, 467 Statement class, 320, 328 StatementCallback instance, 330 StatementCreator instance, 330 states, 723–725 static, 147 static fromInt( ) method, 397 static AOP, 149 static initialization method, 78 static Map tag, 761 StaticMessageSource interface, 134 StaticMethodMatcher base class, 173 StaticMethodMatcherPointcut class, 172–175, 178 StatisticsService bean, 854 StatusController subclass, 691–692 StatusController.handleRequestInternal method, 692 stdout function, 77, 160, 449 StdSchedulerFactory class, 456, 466 StdSchedulerFactory.getScheduler( ) class, 456 step1.jsp page, 640, 642, 644 step2.jsp page, 640–642, 644 StockService bean, 213, 216, 220, 225, 227, 229, 239, 242–245, 248, 252 StockServiceAspect class, 247, 249–250 StockServiceAspect.aj source file, 249 stockService.getStockLevel( ) method, 217, 227, 237 stop( ) method, 201 StopWatch class, 164–165 StoredProcedure class, 349–351 Strategy pattern, 291 stressTest( ) method, 94, 96 string alias, 378 String argument, 45, 210 String class, 46–47, 52, 65, 71, 110, 124, 347, 452, 567, 662, 792 String[] getConfigLocations( ) method, 810 StringArrayPropertyEditor implementation, 113 StringTrimmerEditor implementation, 113 String-typed properties, 114, 118 StringValueResolver interface, 107 StringWriter class, 506 structural patterns, 287–289 struts, 19, 21 stubs, 795 style attribute, 657 Subflow state, 723 subflows, 737–738 element, 737 subject property, 484 submit buttons, 726 Subversion source code, 716 suffix property, 248 superFoo bean, 59 Supplier object, 429, 838 supplier property, 432 SupplierDao.findByName method, 845 supportedMethods property, 617 svc-context-*.xml file, 585 svc-context-nt.xml file, 586 svc-context-ptx.xml configuration file, 589 synchronizeOnSession property, 617 SyncTaskExecutor implementation, 473 System.out.print( ) method, 165 System.out.println(beanFactory.getBean (“obscenitiesRemoved”)) method, 110 SystemoutSimpleBean interface, 81 SystemPointcuts class, 205, 212 SystemPointcuts testBeanExecution( ) method, 211 T t_customer table, 323, 341, 353, 367, 369, 376, 384 T_Customer_Detail table, 384 t_discount table, 838 t_invoice table, 431, 838, 841 t_invoice_line table, 838 t_log_entry table, 413, 423 t_supplier table, 838, 841 List query(String sql, ParameterizedRowMapper rm, Map args) method, 365 List query(String sql, ParameterizedRowMapper rm, Object args) method, 365 List query(String sql, ParameterizedRowMapper rm, SqlParameterSource args) method, 365 tags folder, 716 target argument, 233 Target class, 65–66 target directory, 280 target expression, 207, 210 _target parameter, 642 targetNamespace attribute, 551, 554 targets, 148 TaskExecutor interface, 473–475 TaskRejectedException class, 475 TemlateLoaderPath interface, 674 Template Method pattern, 292–293 Template object, 506 TemplatelessHibernateInvoiceLogEntryDao bean, 410 TemplatelessHibernateLogEntryDao class, 411 TemplatelessHibernateLogEntryDaoDemo class, 412 9217chIDX.qxd 7/25/08 5:46 PM Page 887 ■INDEX TemplateLoader class, 501, 504–505 Template.process( ) method, 506 test bean, 206 test directory, 22, 280 test( ) method, 187 testability, TestBean class, 199 TestBean2 class, 205–206, 208, 211–212 testBeanExec @pointcut, 208 testBeanExecution method, 203–204 TestCase class, 794 TestContext class, 819, 821 TestContext Framework application context with, 820–822 DI with, 821–822 overview, 819–820 support classes, 824–825 transactions in, 822–824 TestContextManager class, 819 TestExecutionListener interface, 819 testFindById method, 852 testing, 793–827 coverage, 826 integration AbstractAnnotationAwareTransactionalTests, 813–817 AbstractDependencyInjectionSpringContextTests, 809–811 AbstractSpringContextTests, 807–809 AbstractTransactionalSpringContextTests, 811–813 JNDI, 817–819 overview, 800–807 overview, 793 performance, 851–853 TestContext Framework, 819–825 unit, 793–800 TestingAuthenticationProvider class, 749 testStartExecution method, 754 text attribute, 622–623, 631, 634, 638, 640–641, 646, 652–653, 656, 668, 676, 686 textarea tag, 666–667 text/html type, 488, 495 text/plain type, 495 textSource bean, 120, 515–517, 523 TextSource interface, 516–517, 521 textSource object, 516 textSource Spring bean, 515 TextSource.groovy file, 521, 523 TextToBoolean class, 742 TextToClass class, 742 TextToFlightNumber converter, 743 TextToLabeledEnum class, 742 TextToNumber class, 742 thankYou state, 737 theme tag, 631–632, 634, 638, 640–641, 646, 651–653, 686 theme_.properties property, 632 themeResolver bean, 632, 652–653 themes, 630–632 this expression, 207, 210 this symbol, 523 this.getPredictedStockLevel(sku) method, 246 this.meaningOfLife.execute(Collections emptyMap( )) method, 350 thread pooling, 471–475 ThreadLocal class, 158 ThreadPoolExecutor class, 472, 475 ThreadPoolTaskExecutor class, 473, 475 Thread.yield( ) method, 472 throw new NullPointerException( ) method, 649 throwing( ) property, 217, 235 throws advice, 167–169 ThrowsAdvice interface, 167 throws-pattern argument, 209 tile extension, 614 tileController bean, 690 TileController subclass, 690–691, 693–694 tile-menu view, 694 tileMethodNameResolver bean, 690 Tiles example application, 21, 684–696 TilesConfigurer bean, 685, 688 TilesDefinitionsFactory instance, 685 tag, 687 tag, 687 tiles-layout.xml file, 685, 692, 694 timeout attribute, 596, 599 TIMEOUT_DEFAULT propagation level, 597–598 Timer class, 7, 447, 449, 460 timerFactory bean, 450 TimerFactoryBean class, 449–452 Timer.schedule( ) method, 447–448 Timer.scheduleAtFixedRate( ) function, 448 TimerTask class, 447, 449, 453–454, 482 TimerTaskExecutor implementation, 473 TimestampingBeanPostProcessor bean, 121–122 to property, 484 tomcat-users.xml file, 570 tool schema, 268 TortoiseSVN tool, 716 toString( ) method, 105, 353, 438, 517, 792 tracker attribute, 224, 239 transaction abstraction layer, 575–576 transaction management, 847–849 Transactional annotation, 211 transactional behavior, 419–424 transactional tests, 819 TransactionalTestExecutionListener class, 820, 822 transactionAttributes property, 593, 596–597 887 9217chIDX.qxd 888 7/25/08 5:46 PM Page 888 ■INDEX TransactionAwareWorkerFactory interface, 605 TransactionCallback class, 590 TransactionCallback.doInTransaction method, 590 TransactionCallbackWithoutResult.doInTransaction method, 590 TransactionCallbackWithoutResult interface, 590 Transaction.commit( ) method, 404 TransactionDefinition instance, 589 TransactionDefinition interface, 576–577, 579 TransactionDefinition.ISOLATION_ DEFAULT isolation level, 577 TransactionDefinition.ISOLATION_READ_ COMMITTED isolation level, 577 TransactionDefinition.ISOLATION_READ_ UNCOMMITTED isolation level, 577 TransactionDefinition.ISOLATION_ REPEATABLE_READ isolation level, 577 TransactionDefinition.ISOLATION_ SERIALIZABLE isolation level, 577 TransactionDefinition.PROPAGATION_ MANDATORY propagation behavior, 578 TransactionDefinition.PROPAGATION_NESTED propagation behavior, 578 TransactionDefinition.PROPAGATION_ NEVER propagation behavior, 578 TransactionDefinition.PROPAGATION_NOT_ SUPPORTED propagation behavior, 578 TransactionDefinition.PROPAGATION_ REQUIRED propagation behavior, 578, 589 TransactionDefinition.PROPAGATION_ REQUIRES_NEW propagation behavior, 578 TransactionDefinition.PROPAGATION_ SUPPORTS propagation behavior, 578 transactionManager attribute, 595, 598 transactionManager bean, 212, 420, 589 TransactionManager interface, 599 transactionManagerName property, 600 transactionProperties property, 592 TransactionProxyFactoryBean interface, 591–593, 597 transactions, implementing synchronization, 601–609 management of AOP, 594–599 declarative, 591–594 programmatic, 588–591 sample, 579–588 overview, 575 properties of, 576–579 Spring Framework, in TestContext Framework, 822–824 transaction abstraction layer, 575–576 working with over multiple transactional resources, 599–601 TransactionStatus instance, 589 TransactionStatus interface, 576, 578–579 TransactionSynchronization interface, 602, 607, 609 TransactionSynchronizationAdapter interface, 607 TransactionSynchronizationManager interface, 575, 602, 606–607, 609 transactionSynchronizationRegistryName property, 600 TransactionTemplate class, 590, 592 TransationManager interface, 575 transfer method, 579 transfer=PROPAGATION_REQUIRED method, 593 transform tag, 651, 655 transition child element, 720 element, 725 transitions, 725–727 tag, 547 Trigger class, 455, 457 trigger schemes, 445 TriggerBean element, 466 triggerNow(String) method, 305 triggers, 445–447 trunk folder, 716 try / catch block, 236 tx schema, 266 tag, 212, 575, 596–599 tag, 595 tag, 598–599 tag, 601 tag, 599 TxSynchronizationMain interface, 608 type attribute, 45 typeAlias element, 377 type-pattern expression, 210 U UML diagram, 283–284 Unadvised method, 195 UnicastRemoteObject class, 536 union( ) method, 188, 190 UnionMethodMatcher class, 188 Unit of Work pattern, 301 unit testing, 793–800 unsent( ) method, 503 update method, 345–348 update(Customer) method, 392 update(Object[]) method, 343 upload method, 302 URL mapping, 569 9217chIDX.qxd 7/25/08 5:46 PM Page 889 ■INDEX UrlBasedViewResolver implementation, 626 urlDecode property, 615 URLEditor implementation, 113 URLMapper class, 547 urlPathHelper property, 614 UrlResource instance, 145 useCacheControlHeader property, 617 use-default-filters=“false” attribute, 131 useExpiresHeader property, 617 User class, 703, 760 user interface transactions, 301–304 User object, 390, 397, 761 user username, 751 User[] array, 703 UserDao interface, 760, 766, 803 UserDetailsService class, 749 UserInfo class, 157–159 username property, 104, 570–572 username string, 760 UsernamePasswordCredentials class, 572 userRole property, 397 UserService bean, 214, 216, 225–227, 229, 236, 239, 248, 252, 801 userService.login( ) method, 215, 225, 227, 237 UserService.setAdministratorUsername method, 225, 237 UserTransaction class, 600 userTransactionName property, 600 usingColumns(String ) method, 370 util schema, 263–265 util.concurrent package, 471 util:constant element, 263 util.js script, 768 util:list element, 264 util:map element, 44, 264 util:properties element, 264 util:property-path element, 265 util:set element, 265 V validate method, 735 validatePage( ) method, 633, 644 validateStart method, 735 ValidationUtils class, 638, 667 Validator implementations, 735 Validator interface, 511, 529, 637 validator property, 644 value attribute, 46–47, 655, 727 value tag, 46–47 var attribute, 631–632, 634, 638, 640–641, 646, 652–653, 655, 686 velocity dependency, 19 Velocity view templating engine, 669–673, 849 velocityConfigurer bean, 670–671, 673 VelocityConfigurer class, 669–670 version property, 419 view attribute, 724 view component, 611 View interface, 613, 622, 704–705 view( ) method, 619, 680–681 View resolveViewName(String viewName, Locale locale) throws Exception method, 625 view resolving, 747 view state, 723–724 viewFactoryCreator, 744 viewName property, 617–618 viewname.class=class-name property, 626 viewNameTranslator bean, 705 viewname.url=view-url property, 626 ViewProductController view, 701–702 viewResolver bean, 626, 674 ViewResolver infrastructure, 724, 744 views Excel, 682–684 PDF, 680–682 performance, 849 using programmatically, 622–625 using view resolvers, 625–628 XSLT, 678–680 views_.properties file, 626 views_ES.properties file, 626 viewScope variable, 728 views.properties file, 646, 670, 672–673, 680–681, 688, 692, 698–699, 709 element, 724, 732 void com.apress.annotations.*Service( ) method, 131 void execute(String) method, 331 void query(PreparedStatementCreator, RowCallback) method, 336 void query(String, Object[], RowCallback) method, 336 void query(String, PreparedStatementSetter, RowCallback) method, 336 void query(String, RowCallbackHandler) method, 335 void register(User user) method, 802 void testRegister( ) method, 807 void testRegisterIncorrectPassword( ) method, 807 W W character, 461 WeakKeyCheckAdvice class, 164 WeakKeyCheckAdvice interface, 162 weaving, 148 Web Flow browser navigation bar support and double submit, 753 core concepts, 713–715 dependencies, 718 expression languages, 727–728 flow definition registry, 742–744 889 9217chIDX.qxd 890 7/25/08 5:46 PM Page 890 ■INDEX flow execution architecture, 739–741 flow execution repository, 745 flow executor, 741 Hello, World!, 719–723 implementing actions, 731–732 input and output parameters, 736–737 integration with Spring MVC, 746–747 model data binding, 732–736 obtaining, 716–718 overview, 712 partial rendering of views, 736 scopes, 728–731 security, 747–752 stateful navigational control, 753 states, 723–725 subflows, 737–738 testing flow definitions, 753–754 transitions, 725–727 web layer, unit testing of, 798–800 Web Services Description Language (WSDL), 545 WebApplicationObjectSupport class, 616 WebContentGenerator class, 616 element, 742 WEB-INF directory, 719 WEB-INF/lib folder, 758 /WEB-INF/views/en_GB/product directory, 627 /WEB-INF/views/en_GB/product/index.ftl, 674 /WEB-INF/views/en_GB/product/index.jsp directory, 627 /WEB-INF/views/es_ES/product directory, 627 WEB-INF/views/product/index.vm directory, 670 /WEB-INF/views/product/viewProduct.jsp file, 702 /WEB-INF/views/registration.jsp, 705 WebLogicLoadTimeWeaver implementation, 254 WebLogicNativeJdbcExtractor extractor, 359 WebSphereNativeJdbcExtractor extractor, 359 web.xml file, 557, 613, 689, 696, 720, 748, 763 withCatalogName(String catalogName) method, 368 withFunctionName(String functionName) method, 368 withFunctionName(String) method, 368 within expression, 207, 209–210 withinProSpringPackage @pointcut, 208 withoutProcedureColumnMetaDataAccess( ) method, 368–369 withProcedureName(String procedureName) method, 368 withReturnValue( ) method, 368 withSchemaName(String schemaName) method, 368 withTableName(String) method, 370 work( ) method, 165, 201, 421, 608 worker argument, 605 Worker class, 601–602, 609 WorkerBean class, 164–165 worker.commit( ) method, 602, 607, 609 workerFactory bean, 608 WorkerFactory interface, 602, 605, 608 WorkerFactoryContext interface, 605–606 worker.rollback( ) method, 602, 607, 609 WorkerTransactionSynchronization interface, 606, 609 worker.work method, 602 worker.work(10) method, 602 work(int) method, 601 WorkManagerTaskExecutor implementation, 473 Wrapper patterns, 288–289 write method, 25 writeMessage( ) method, 150, 152, 162 WSDL (Web Services Description Language), 545 wsdlDocumentUrl property, 550, 555, 559–560 wsdl.exe tool, 560–561 tag, 551 tag, 551 X x( ) and target(y) pointcut expression, 240 x(“A”, “B”) method, 210 XAPoolNativeJdbcExtractor extractor, 359 x(CharSequence, String) method, 210 xdoclet dependency, 19 XFire framework, 557–559 xfire servlet, 557 xfire.jar servlet, 557 xfire-servlet.xml file, 558 xfire.xml file, 558–559 xlsReportHandler( ) method, 699 XML, 41–42, 211–212, 373, 596–599, 759 XmlApplicationContext implementation, 805 XmlBeanDefinitionReader class, 40–41, 268 XmlBeanFactory class, 41, 47, 50, 83, 105, 126 XMLHttpRequest object, 767 XmlViewResolver implementation, 626 XmlWebApplicationContext interface, 126 xsd:string type, 552 param-value tag, 679 XSLT views, 678–680 x.y.User[] array, 703 Y YourKit Java Profiler, 830 ... 921 7ch00FM.qxd 7 / 25 /08 5: 58 PM Page i Pro Spring 2. 5 Jan Machacek, Aleksa Vukotic, Anirvan Chakraborty, and Jessica Ditt 921 7ch00FM.qxd 7/30/08 3 :54 PM Page ii Pro Spring 2. 5 Copyright © 20 08... please contact Apress directly at 28 55 Telegraph Avenue, Suite 600, Berkeley, CA 947 05 Phone 51 0 -54 9 -59 30, fax 51 0 -54 9 -59 39, e-mail info @apress. com, or visit http://www .apress. com Apress and friends... 855 ■INDEX 857 xix 921 7ch00FM.qxd 7 / 25 /08 5: 58 PM Page xx 921 7ch00FM.qxd 7 / 25 /08 5: 58 PM Page xxi Foreword