The Spring Framework - Reference Documentation

Authors

Rod Johnson, Juergen Hoeller, Alef Arendsen, Colin Sampaleanu, Rob Harrop, Thomas Risberg, Darren Davison, Dmitriy Kopylenko, Mark Pollack, Thierry Templier, Erwin Vervaet, Portia Tung, Ben Hale, Adrian Colyer, John Lewis, Costin Leau, Mark Fisher, Sam Brannen, Ramnivas Laddad, Arjen Poutsma

2.5.6

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


Table of Contents

Preface
1. Introduction
1.1. Overview
1.2. Usage scenarios
2. What's new in Spring 2.0 and 2.5?
2.1. Introduction
2.2. The Inversion of Control (IoC) container
2.2.1. New bean scopes
2.2.2. Easier XML configuration
2.2.3. Extensible XML authoring
2.2.4. Annotation-driven configuration
2.2.5. Autodetecting components in the classpath
2.3. Aspect Oriented Programming (AOP)
2.3.1. Easier AOP XML configuration
2.3.2. Support for @AspectJ aspects
2.3.3. Support for bean name pointcut element
2.3.4. Support for AspectJ load-time weaving
2.4. The Middle Tier
2.4.1. Easier configuration of declarative transactions in XML
2.4.2. Full WebSphere transaction management support
2.4.3. JPA
2.4.4. Asynchronous JMS
2.4.5. JDBC
2.5. The Web Tier
2.5.1. Sensible defaulting in Spring MVC
2.5.2. Portlet framework
2.5.3. Annotation-based controllers
2.5.4. A form tag library for Spring MVC
2.5.5. Tiles 2 support
2.5.6. JSF 1.2 support
2.5.7. JAX-WS support
2.6. Everything else
2.6.1. Dynamic language support
2.6.2. Enhanced testing support
2.6.3. JMX support
2.6.4. Deploying a Spring application context as JCA adapter
2.6.5. Task scheduling
2.6.6. Java 5 (Tiger) support
2.7. Migrating to Spring 2.5
2.7.1. Changes
2.7.1.1. Supported JDK versions
2.7.1.2. Jar packaging in Spring 2.5
2.7.1.3. XML configuration
2.7.1.4. Deprecated classes and methods
2.7.1.5. Apache OJB
2.7.1.6. iBATIS
2.7.1.7. Hibernate
2.7.1.8. JDO
2.7.1.9. UrlFilenameViewController
2.8. Updated sample applications
2.9. Improved documentation
I. Core Technologies
3. The IoC container
3.1. Introduction
3.2. Basics - containers and beans
3.2.1. The container
3.2.1.1. Configuration metadata
3.2.2. Instantiating a container
3.2.2.1. Composing XML-based configuration metadata
3.2.3. The beans
3.2.3.1. Naming beans
3.2.3.2. Instantiating beans
3.2.4. Using the container
3.3. Dependencies
3.3.1. Injecting dependencies
3.3.1.1. Constructor Injection
3.3.1.2. Setter Injection
3.3.1.3. Some examples
3.3.2. Dependencies and configuration in detail
3.3.2.1. Straight values (primitives, Strings, etc.)
3.3.2.2. References to other beans (collaborators)
3.3.2.3. Inner beans
3.3.2.4. Collections
3.3.2.5. Nulls
3.3.2.6. Shortcuts and other convenience options for XML-based configuration metadata
3.3.2.7. Compound property names
3.3.3. Using depends-on
3.3.4. Lazily-instantiated beans
3.3.5. Autowiring collaborators
3.3.5.1. Excluding a bean from being available for autowiring
3.3.6. Checking for dependencies
3.3.7. Method Injection
3.3.7.1. Lookup method injection
3.3.7.2. Arbitrary method replacement
3.4. Bean scopes
3.4.1. The singleton scope
3.4.2. The prototype scope
3.4.3. Singleton beans with prototype-bean dependencies
3.4.4. The other scopes
3.4.4.1. Initial web configuration
3.4.4.2. The request scope
3.4.4.3. The session scope
3.4.4.4. The global session scope
3.4.4.5. Scoped beans as dependencies
3.4.5. Custom scopes
3.4.5.1. Creating your own custom scope
3.4.5.2. Using a custom scope
3.5. Customizing the nature of a bean
3.5.1. Lifecycle callbacks
3.5.1.1. Initialization callbacks
3.5.1.2. Destruction callbacks
3.5.1.3. Default initialization & destroy methods
3.5.1.4. Combining lifecycle mechanisms
3.5.1.5. Shutting down the Spring IoC container gracefully in non-web applications
3.5.2. Knowing who you are
3.5.2.1. BeanFactoryAware
3.5.2.2. BeanNameAware
3.6. Bean definition inheritance
3.7. Container extension points
3.7.1. Customizing beans using BeanPostProcessors
3.7.1.1. Example: Hello World, BeanPostProcessor-style
3.7.1.2. Example: The RequiredAnnotationBeanPostProcessor
3.7.2. Customizing configuration metadata with BeanFactoryPostProcessors
3.7.2.1. Example: the PropertyPlaceholderConfigurer
3.7.2.2. Example: the PropertyOverrideConfigurer
3.7.3. Customizing instantiation logic using FactoryBeans
3.8. The ApplicationContext
3.8.1. BeanFactory or ApplicationContext?
3.8.2. Internationalization using MessageSources
3.8.3. Events
3.8.4. Convenient access to low-level resources
3.8.5. Convenient ApplicationContext instantiation for web applications
3.9. Glue code and the evil singleton
3.10. Deploying a Spring ApplicationContext as a J2EE RAR file
3.11. Annotation-based configuration
3.11.1. @Required
3.11.2. @Autowired
3.11.3. Fine-tuning annotation-based autowiring with qualifiers
3.11.4. CustomAutowireConfigurer
3.11.5. @Resource
3.11.6. @PostConstruct and @PreDestroy
3.12. Classpath scanning for managed components
3.12.1. @Component and further stereotype annotations
3.12.2. Auto-detecting components
3.12.3. Using filters to customize scanning
3.12.4. Naming autodetected components
3.12.5. Providing a scope for autodetected components
3.12.6. Providing qualifier metadata with annotations
3.13. Registering a LoadTimeWeaver
4. Resources
4.1. Introduction
4.2. The Resource interface
4.3. Built-in Resource implementations
4.3.1. UrlResource
4.3.2. ClassPathResource
4.3.3. FileSystemResource
4.3.4. ServletContextResource
4.3.5. InputStreamResource
4.3.6. ByteArrayResource
4.4. The ResourceLoader
4.5. The ResourceLoaderAware interface
4.6. Resources as dependencies
4.7. Application contexts and Resource paths
4.7.1. Constructing application contexts
4.7.1.1. Constructing ClassPathXmlApplicationContext instances - shortcuts
4.7.2. Wildcards in application context constructor resource paths
4.7.2.1. Ant-style Patterns
4.7.2.2. The classpath*: prefix
4.7.2.3. Other notes relating to wildcards
4.7.3. FileSystemResource caveats
5. Validation, Data-binding, the BeanWrapper, and PropertyEditors
5.1. Introduction
5.2. Validation using Spring's Validator interface
5.3. Resolving codes to error messages
5.4. Bean manipulation and the BeanWrapper
5.4.1. Setting and getting basic and nested properties
5.4.2. Built-in PropertyEditor implementations
5.4.2.1. Registering additional custom PropertyEditors
6. Aspect Oriented Programming with Spring
6.1. Introduction
6.1.1. AOP concepts
6.1.2. Spring AOP capabilities and goals
6.1.3. AOP Proxies
6.2. @AspectJ support
6.2.1. Enabling @AspectJ Support
6.2.2. Declaring an aspect
6.2.3. Declaring a pointcut
6.2.3.1. Supported Pointcut Designators
6.2.3.2. Combining pointcut expressions
6.2.3.3. Sharing common pointcut definitions
6.2.3.4. Examples
6.2.4. Declaring advice
6.2.4.1. Before advice
6.2.4.2. After returning advice
6.2.4.3. After throwing advice
6.2.4.4. After (finally) advice
6.2.4.5. Around advice
6.2.4.6. Advice parameters
6.2.4.7. Advice ordering
6.2.5. Introductions
6.2.6. Aspect instantiation models
6.2.7. Example
6.3. Schema-based AOP support
6.3.1. Declaring an aspect
6.3.2. Declaring a pointcut
6.3.3. Declaring advice
6.3.3.1. Before advice
6.3.3.2. After returning advice
6.3.3.3. After throwing advice
6.3.3.4. After (finally) advice
6.3.3.5. Around advice
6.3.3.6. Advice parameters
6.3.3.7. Advice ordering
6.3.4. Introductions
6.3.5. Aspect instantiation models
6.3.6. Advisors
6.3.7. Example
6.4. Choosing which AOP declaration style to use
6.4.1. Spring AOP or full AspectJ?
6.4.2. @AspectJ or XML for Spring AOP?
6.5. Mixing aspect types
6.6. Proxying mechanisms
6.6.1. Understanding AOP proxies
6.7. Programmatic creation of @AspectJ Proxies
6.8. Using AspectJ with Spring applications
6.8.1. Using AspectJ to dependency inject domain objects with Spring
6.8.1.1. Unit testing @Configurable objects
6.8.1.2. Working with multiple application contexts
6.8.2. Other Spring aspects for AspectJ
6.8.3. Configuring AspectJ aspects using Spring IoC
6.8.4. Load-time weaving with AspectJ in the Spring Framework
6.8.4.1. A first example
6.8.4.2. Aspects
6.8.4.3. 'META-INF/aop.xml'
6.8.4.4. Required libraries (JARS)
6.8.4.5. Spring configuration
6.8.4.6. Environment-specific configuration
6.9. Further Resources
7. Spring AOP APIs
7.1. Introduction
7.2. Pointcut API in Spring
7.2.1. Concepts
7.2.2. Operations on pointcuts
7.2.3. AspectJ expression pointcuts
7.2.4. Convenience pointcut implementations
7.2.4.1. Static pointcuts
7.2.4.2. Dynamic pointcuts
7.2.5. Pointcut superclasses
7.2.6. Custom pointcuts
7.3. Advice API in Spring
7.3.1. Advice lifecycles
7.3.2. Advice types in Spring
7.3.2.1. Interception around advice
7.3.2.2. Before advice
7.3.2.3. Throws advice
7.3.2.4. After Returning advice
7.3.2.5. Introduction advice
7.4. Advisor API in Spring
7.5. Using the ProxyFactoryBean to create AOP proxies
7.5.1. Basics
7.5.2. JavaBean properties
7.5.3. JDK- and CGLIB-based proxies
7.5.4. Proxying interfaces
7.5.5. Proxying classes
7.5.6. Using 'global' advisors
7.6. Concise proxy definitions
7.7. Creating AOP proxies programmatically with the ProxyFactory
7.8. Manipulating advised objects
7.9. Using the "autoproxy" facility
7.9.1. Autoproxy bean definitions
7.9.1.1. BeanNameAutoProxyCreator
7.9.1.2. DefaultAdvisorAutoProxyCreator
7.9.1.3. AbstractAdvisorAutoProxyCreator
7.9.2. Using metadata-driven auto-proxying
7.10. Using TargetSources
7.10.1. Hot swappable target sources
7.10.2. Pooling target sources
7.10.3. Prototype target sources
7.10.4. ThreadLocal target sources
7.11. Defining new Advice types
7.12. Further resources
8. Testing
8.1. Introduction
8.2. Unit testing
8.2.1. Mock objects
8.2.1.1. JNDI
8.2.1.2. Servlet API
8.2.1.3. Portlet API
8.2.2. Unit testing support classes
8.2.2.1. General utilities
8.2.2.2. Spring MVC
8.3. Integration testing
8.3.1. Overview
8.3.2. Which support framework to use
8.3.3. Common goals
8.3.3.1. Context management and caching
8.3.3.2. Dependency Injection of test fixtures
8.3.3.3. Transaction management
8.3.3.4. Integration testing support classes
8.3.4. JDBC testing support
8.3.5. Common annotations
8.3.6. JUnit 3.8 legacy support
8.3.6.1. Context management and caching
8.3.6.2. Dependency Injection of test fixtures
8.3.6.3. Transaction management
8.3.6.4. JUnit 3.8 legacy support classes
8.3.6.5. Java 5+ specific support
8.3.7. Spring TestContext Framework
8.3.7.1. Key abstractions
8.3.7.2. Context management and caching
8.3.7.3. Dependency Injection of test fixtures
8.3.7.4. Transaction management
8.3.7.5. TestContext support classes
8.3.7.6. TestContext framework annotation support
8.3.8. PetClinic example
8.4. Further Resources
II. Middle Tier Data Access
9. Transaction management
9.1. Introduction
9.2. Motivations
9.3. Key abstractions
9.4. Resource synchronization with transactions
9.4.1. High-level approach
9.4.2. Low-level approach
9.4.3. TransactionAwareDataSourceProxy
9.5. Declarative transaction management
9.5.1. Understanding the Spring Framework's declarative transaction implementation
9.5.2. A first example
9.5.3. Rolling back
9.5.4. Configuring different transactional semantics for different beans
9.5.5. <tx:advice/> settings
9.5.6. Using @Transactional
9.5.6.1. @Transactional settings
9.5.7. Transaction propagation
9.5.7.1. Required
9.5.7.2. RequiresNew
9.5.7.3. Nested
9.5.8. Advising transactional operations
9.5.9. Using @Transactional with AspectJ
9.6. Programmatic transaction management
9.6.1. Using the TransactionTemplate
9.6.1.1. Specifying transaction settings
9.6.2. Using the PlatformTransactionManager
9.7. Choosing between programmatic and declarative transaction management
9.8. Application server-specific integration
9.8.1. IBM WebSphere
9.8.2. BEA WebLogic
9.8.3. Oracle OC4J
9.9. Solutions to common problems
9.9.1. Use of the wrong transaction manager for a specific DataSource
9.10. Further Resources
10. DAO support
10.1. Introduction
10.2. Consistent exception hierarchy
10.3. Consistent abstract classes for DAO support
11. Data access using JDBC
11.1. Introduction
11.1.1. Choosing a style
11.1.2. The package hierarchy
11.2. Using the JDBC Core classes to control basic JDBC processing and error handling
11.2.1. JdbcTemplate
11.2.1.1. Examples
11.2.1.2. JdbcTemplate idioms (best practices)
11.2.2. NamedParameterJdbcTemplate
11.2.3. SimpleJdbcTemplate
11.2.4. DataSource
11.2.5. SQLExceptionTranslator
11.2.6. Executing statements
11.2.7. Running Queries
11.2.8. Updating the database
11.2.9. Retrieving auto-generated keys
11.3. Controlling database connections
11.3.1. DataSourceUtils
11.3.2. SmartDataSource
11.3.3. AbstractDataSource
11.3.4. SingleConnectionDataSource
11.3.5. DriverManagerDataSource
11.3.6. TransactionAwareDataSourceProxy
11.3.7. DataSourceTransactionManager
11.3.8. NativeJdbcExtractor
11.4. JDBC batch operations
11.4.1. Batch operations with the JdbcTemplate
11.4.2. Batch operations with the SimpleJdbcTemplate
11.5. Simplifying JDBC operations with the SimpleJdbc classes
11.5.1. Inserting data using SimpleJdbcInsert
11.5.2. Retrieving auto-generated keys using SimpleJdbcInsert
11.5.3. Specifying the columns to use for a SimpleJdbcInsert
11.5.4. Using SqlParameterSource to provide parameter values
11.5.5. Calling a stored procedure using SimpleJdbcCall
11.5.6. Declaring parameters to use for a SimpleJdbcCall
11.5.7. How to define SqlParameters
11.5.8. Calling a stored function using SimpleJdbcCall
11.5.9. Returning ResultSet/REF Cursor from a SimpleJdbcCall
11.6. Modeling JDBC operations as Java objects
11.6.1. SqlQuery
11.6.2. MappingSqlQuery
11.6.3. SqlUpdate
11.6.4. StoredProcedure
11.6.5. SqlFunction
11.7. Common issues with parameter and data value handling
11.7.1. Providing SQL type information for parameters
11.7.2. Handling BLOB and CLOB objects
11.7.3. Passing in lists of values for IN clause
11.7.4. Handling complex types for stored procedure calls
12. Object Relational Mapping (ORM) data access
12.1. Introduction
12.2. Hibernate
12.2.1. Resource management
12.2.2. SessionFactory setup in a Spring container
12.2.3. The HibernateTemplate
12.2.4. Implementing Spring-based DAOs without callbacks
12.2.5. Implementing DAOs based on plain Hibernate 3 API
12.2.6. Programmatic transaction demarcation
12.2.7. Declarative transaction demarcation
12.2.8. Transaction management strategies
12.2.9. Container resources versus local resources
12.2.10. Spurious application server warnings when using Hibernate
12.3. JDO
12.3.1. PersistenceManagerFactory setup
12.3.2. JdoTemplate and JdoDaoSupport
12.3.3. Implementing DAOs based on the plain JDO API
12.3.4. Transaction management
12.3.5. JdoDialect
12.4. Oracle TopLink
12.4.1. SessionFactory abstraction
12.4.2. TopLinkTemplate and TopLinkDaoSupport
12.4.3. Implementing DAOs based on plain TopLink API
12.4.4. Transaction management
12.5. iBATIS SQL Maps
12.5.1. Setting up the SqlMapClient
12.5.2. Using SqlMapClientTemplate and SqlMapClientDaoSupport
12.5.3. Implementing DAOs based on plain iBATIS API
12.6. JPA
12.6.1. JPA setup in a Spring environment
12.6.1.1. LocalEntityManagerFactoryBean
12.6.1.2. Obtaining an EntityManagerFactory from JNDI
12.6.1.3. LocalContainerEntityManagerFactoryBean
12.6.1.4. Dealing with multiple persistence units
12.6.2. JpaTemplate and JpaDaoSupport
12.6.3. Implementing DAOs based on plain JPA
12.6.4. Exception Translation
12.7. Transaction Management
12.8. JpaDialect
III. The Web
13. Web MVC framework
13.1. Introduction
13.1.1. Pluggability of other MVC implementations
13.1.2. Features of Spring Web MVC
13.2. The DispatcherServlet
13.3. Controllers
13.3.1. AbstractController and WebContentGenerator
13.3.2. Other simple controllers
13.3.3. The MultiActionController
13.3.4. Command controllers
13.4. Handler mappings
13.4.1. BeanNameUrlHandlerMapping
13.4.2. SimpleUrlHandlerMapping
13.4.3. Intercepting requests - the HandlerInterceptor interface
13.5. Views and resolving them
13.5.1. Resolving views - the ViewResolver interface
13.5.2. Chaining ViewResolvers
13.5.3. Redirecting to views
13.5.3.1. RedirectView
13.5.3.2. The redirect: prefix
13.5.3.3. The forward: prefix
13.6. Using locales
13.6.1. AcceptHeaderLocaleResolver
13.6.2. CookieLocaleResolver
13.6.3. SessionLocaleResolver
13.6.4. LocaleChangeInterceptor
13.7. Using themes
13.7.1. Introduction
13.7.2. Defining themes
13.7.3. Theme resolvers
13.8. Spring's multipart (fileupload) support
13.8.1. Introduction
13.8.2. Using the MultipartResolver
13.8.3. Handling a file upload in a form
13.9. Handling exceptions
13.10. Convention over configuration
13.10.1. The Controller - ControllerClassNameHandlerMapping
13.10.2. The Model - ModelMap (ModelAndView)
13.10.3. The View - RequestToViewNameTranslator
13.11. Annotation-based controller configuration
13.11.1. Setting up the dispatcher for annotation support
13.11.2. Defining a controller with @Controller
13.11.3. Mapping requests with @RequestMapping
13.11.3.1. Advanced @RequestMapping options
13.11.4. Supported handler method arguments and return types
13.11.5. Binding request parameters to method parameters with @RequestParam
13.11.6. Providing a link to data from the model with @ModelAttribute
13.11.7. Specifying attributes to store in a Session with @SessionAttributes
13.11.8. Customizing WebDataBinder initialization
13.11.8.1. Customizing data binding with @InitBinder
13.11.8.2. Configuring a custom WebBindingInitializer
13.12. Further Resources
14. View technologies
14.1. Introduction
14.2. JSP & JSTL
14.2.1. View resolvers
14.2.2. 'Plain-old' JSPs versus JSTL
14.2.3. Additional tags facilitating development
14.2.4. Using Spring's form tag library
14.2.4.1. Configuration
14.2.4.2. The form tag
14.2.4.3. The input tag
14.2.4.4. The checkbox tag
14.2.4.5. The checkboxes tag
14.2.4.6. The radiobutton tag
14.2.4.7. The radiobuttons tag
14.2.4.8. The password tag
14.2.4.9. The select tag
14.2.4.10. The option tag
14.2.4.11. The options tag
14.2.4.12. The textarea tag
14.2.4.13. The hidden tag
14.2.4.14. The errors tag
14.3. Tiles
14.3.1. Dependencies
14.3.2. How to integrate Tiles
14.3.2.1. UrlBasedViewResolver
14.3.2.2. ResourceBundleViewResolver
14.3.2.3. SimpleSpringPreparerFactory and SpringBeanPreparerFactory
14.4. Velocity & FreeMarker
14.4.1. Dependencies
14.4.2. Context configuration
14.4.3. Creating templates
14.4.4. Advanced configuration
14.4.4.1. velocity.properties
14.4.4.2. FreeMarker
14.4.5. Bind support and form handling
14.4.5.1. The bind macros
14.4.5.2. Simple binding
14.4.5.3. Form input generation macros
14.4.5.4. HTML escaping and XHTML compliance
14.5. XSLT
14.5.1. My First Words
14.5.1.1. Bean definitions
14.5.1.2. Standard MVC controller code
14.5.1.3. Convert the model data to XML
14.5.1.4. Defining the view properties
14.5.1.5. Document transformation
14.5.2. Summary
14.6. Document views (PDF/Excel)
14.6.1. Introduction
14.6.2. Configuration and setup
14.6.2.1. Document view definitions
14.6.2.2. Controller code
14.6.2.3. Subclassing for Excel views
14.6.2.4. Subclassing for PDF views
14.7. JasperReports
14.7.1. Dependencies
14.7.2. Configuration
14.7.2.1. Configuring the ViewResolver
14.7.2.2. Configuring the Views
14.7.2.3. About Report Files
14.7.2.4. Using JasperReportsMultiFormatView
14.7.3. Populating the ModelAndView
14.7.4. Working with Sub-Reports
14.7.4.1. Configuring Sub-Report Files
14.7.4.2. Configuring Sub-Report Data Sources
14.7.5. Configuring Exporter Parameters
15. Integrating with other web frameworks
15.1. Introduction
15.2. Common configuration
15.3. JavaServer Faces 1.1 and 1.2
15.3.1. DelegatingVariableResolver (JSF 1.1/1.2)
15.3.2. SpringBeanVariableResolver (JSF 1.1/1.2)
15.3.3. SpringBeanFacesELResolver (JSF 1.2+)
15.3.4. FacesContextUtils
15.4. Apache Struts 1.x and 2.x
15.4.1. ContextLoaderPlugin
15.4.1.1. DelegatingRequestProcessor
15.4.1.2. DelegatingActionProxy
15.4.2. ActionSupport Classes
15.5. WebWork 2.x
15.6. Tapestry 3.x and 4.x
15.6.1. Injecting Spring-managed beans
15.6.1.1. Dependency Injecting Spring Beans into Tapestry pages
15.6.1.2. Component definition files
15.6.1.3. Adding abstract accessors
15.6.1.4. Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x style
15.7. Further Resources
16. Portlet MVC Framework
16.1. Introduction
16.1.1. Controllers - The C in MVC
16.1.2. Views - The V in MVC
16.1.3. Web-scoped beans
16.2. The DispatcherPortlet
16.3. The ViewRendererServlet
16.4. Controllers
16.4.1. AbstractController and PortletContentGenerator
16.4.2. Other simple controllers
16.4.3. Command Controllers
16.4.4. PortletWrappingController
16.5. Handler mappings
16.5.1. PortletModeHandlerMapping
16.5.2. ParameterHandlerMapping
16.5.3. PortletModeParameterHandlerMapping
16.5.4. Adding HandlerInterceptors
16.5.5. HandlerInterceptorAdapter
16.5.6. ParameterMappingInterceptor
16.6. Views and resolving them
16.7. Multipart (file upload) support
16.7.1. Using the PortletMultipartResolver
16.7.2. Handling a file upload in a form
16.8. Handling exceptions
16.9. Annotation-based controller configuration
16.9.1. Setting up the dispatcher for annotation support
16.9.2. Defining a controller with @Controller
16.9.3. Mapping requests with @RequestMapping
16.9.4. Supported handler method arguments
16.9.5. Binding request parameters to method parameters with @RequestParam
16.9.6. Providing a link to data from the model with @ModelAttribute
16.9.7. Specifying attributes to store in a Session with @SessionAttributes
16.9.8. Customizing WebDataBinder initialization
16.9.8.1. Customizing data binding with @InitBinder
16.9.8.2. Configuring a custom WebBindingInitializer
16.10. Portlet application deployment
IV. Integration
17. Remoting and web services using Spring
17.1. Introduction
17.2. Exposing services using RMI
17.2.1. Exporting the service using the RmiServiceExporter
17.2.2. Linking in the service at the client
17.3. Using Hessian or Burlap to remotely call services via HTTP
17.3.1. Wiring up the DispatcherServlet for Hessian and co.
17.3.2. Exposing your beans by using the HessianServiceExporter
17.3.3. Linking in the service on the client
17.3.4. Using Burlap
17.3.5. Applying HTTP basic authentication to a service exposed through Hessian or Burlap
17.4. Exposing services using HTTP invokers
17.4.1. Exposing the service object
17.4.2. Linking in the service at the client
17.5. Web services
17.5.1. Exposing servlet-based web services using JAX-RPC
17.5.2. Accessing web services using JAX-RPC
17.5.3. Registering JAX-RPC Bean Mappings
17.5.4. Registering your own JAX-RPC Handler
17.5.5. Exposing servlet-based web services using JAX-WS
17.5.6. Exporting standalone web services using JAX-WS
17.5.7. Exporting web services using the JAX-WS RI's Spring support
17.5.8. Accessing web services using JAX-WS
17.5.9. Exposing web services using XFire
17.6. JMS
17.6.1. Server-side configuration
17.6.2. Client-side configuration
17.7. Auto-detection is not implemented for remote interfaces
17.8. Considerations when choosing a technology
18. Enterprise Java Beans (EJB) integration
18.1. Introduction
18.2. Accessing EJBs
18.2.1. Concepts
18.2.2. Accessing local SLSBs
18.2.3. Accessing remote SLSBs
18.2.4. Accessing EJB 2.x SLSBs versus EJB 3 SLSBs
18.3. Using Spring's EJB implementation support classes
18.3.1. EJB 2.x base classes
18.3.2. EJB 3 injection interceptor
19. JMS (Java Message Service)
19.1. Introduction
19.2. Using Spring JMS
19.2.1. JmsTemplate
19.2.2. Connections
19.2.3. Destination Management
19.2.4. Message Listener Containers
19.2.4.1. SimpleMessageListenerContainer
19.2.4.2. DefaultMessageListenerContainer
19.2.4.3. ServerSessionMessageListenerContainer
19.2.5. Transaction management
19.3. Sending a Message
19.3.1. Using Message Converters
19.3.2. SessionCallback and ProducerCallback
19.4. Receiving a message
19.4.1. Synchronous Reception
19.4.2. Asynchronous Reception - Message-Driven POJOs
19.4.3. The SessionAwareMessageListener interface
19.4.4. The MessageListenerAdapter
19.4.5. Processing messages within transactions
19.5. Support for JCA Message Endpoints
19.6. JMS Namespace Support
20. JMX
20.1. Introduction
20.2. Exporting your beans to JMX
20.2.1. Creating an MBeanServer
20.2.2. Reusing an existing MBeanServer
20.2.3. Lazy-initialized MBeans
20.2.4. Automatic registration of MBeans
20.2.5. Controlling the registration behavior
20.3. Controlling the management interface of your beans
20.3.1. The MBeanInfoAssembler Interface
20.3.2. Using source-Level metadata
20.3.3. Using JDK 5.0 Annotations
20.3.4. Source-Level Metadata Types
20.3.5. The AutodetectCapableMBeanInfoAssembler interface
20.3.6. Defining management interfaces using Java interfaces
20.3.7. Using MethodNameBasedMBeanInfoAssembler
20.4. Controlling the ObjectNames for your beans
20.4.1. Reading ObjectNames from Properties
20.4.2. Using the MetadataNamingStrategy
20.4.3. The <context:mbean-export/> element
20.5. JSR-160 Connectors
20.5.1. Server-side Connectors
20.5.2. Client-side Connectors
20.5.3. JMX over Burlap/Hessian/SOAP
20.6. Accessing MBeans via Proxies
20.7. Notifications
20.7.1. Registering Listeners for Notifications
20.7.2. Publishing Notifications
20.8. Further Resources
21. JCA CCI
21.1. Introduction
21.2. Configuring CCI
21.2.1. Connector configuration
21.2.2. ConnectionFactory configuration in Spring
21.2.3. Configuring CCI connections
21.2.4. Using a single CCI connection
21.3. Using Spring's CCI access support
21.3.1. Record conversion
21.3.2. The CciTemplate
21.3.3. DAO support
21.3.4. Automatic output record generation
21.3.5. Summary
21.3.6. Using a CCI Connection and Interaction directly
21.3.7. Example for CciTemplate usage
21.4. Modeling CCI access as operation objects
21.4.1. MappingRecordOperation
21.4.2. MappingCommAreaOperation
21.4.3. Automatic output record generation
21.4.4. Summary
21.4.5. Example for MappingRecordOperation usage
21.4.6. Example for MappingCommAreaOperation usage
21.5. Transactions
22. Email
22.1. Introduction
22.2. Usage
22.2.1. Basic MailSender and SimpleMailMessage usage
22.2.2. Using the JavaMailSender and the MimeMessagePreparator
22.3. Using the JavaMail MimeMessageHelper
22.3.1. Sending attachments and inline resources
22.3.1.1. Attachments
22.3.1.2. Inline resources
22.3.2. Creating email content using a templating library
22.3.2.1. A Velocity-based example
23. Scheduling and Thread Pooling
23.1. Introduction
23.2. Using the OpenSymphony Quartz Scheduler
23.2.1. Using the JobDetailBean
23.2.2. Using the MethodInvokingJobDetailFactoryBean
23.2.3. Wiring up jobs using triggers and the SchedulerFactoryBean
23.3. Using JDK Timer support
23.3.1. Creating custom timers
23.3.2. Using the MethodInvokingTimerTaskFactoryBean
23.3.3. Wrapping up: setting up the tasks using the TimerFactoryBean
23.4. The Spring TaskExecutor abstraction
23.4.1. TaskExecutor types
23.4.2. Using a TaskExecutor
24. Dynamic language support
24.1. Introduction
24.2. A first example
24.3. Defining beans that are backed by dynamic languages
24.3.1. Common concepts
24.3.1.1. The <lang:language/> element
24.3.1.2. Refreshable beans
24.3.1.3. Inline dynamic language source files
24.3.1.4. Understanding Constructor Injection in the context of dynamic-language-backed beans
24.3.2. JRuby beans
24.3.3. Groovy beans
24.3.3.1. Customising Groovy objects via a callback
24.3.4. BeanShell beans
24.4. Scenarios
24.4.1. Scripted Spring MVC Controllers
24.4.2. Scripted Validators
24.5. Bits and bobs
24.5.1. AOP - advising scripted beans
24.5.2. Scoping
24.6. Further Resources
25. Annotations and Source Level Metadata Support
25.1. Introduction
25.2. Spring's metadata support
25.3. Annotations
25.3.1. @Required
25.3.2. Other @Annotations in Spring
25.4. Integration with Jakarta Commons Attributes
25.5. Metadata and Spring AOP autoproxying
25.5.1. Fundamentals
25.5.2. Declarative transaction management
A. XML Schema-based configuration
A.1. Introduction
A.2. XML Schema-based configuration
A.2.1. Referencing the schemas
A.2.2. The util schema
A.2.2.1. <util:constant/>
A.2.2.2. <util:property-path/>
A.2.2.3. <util:properties/>
A.2.2.4. <util:list/>
A.2.2.5. <util:map/>
A.2.2.6. <util:set/>
A.2.3. The jee schema
A.2.3.1. <jee:jndi-lookup/> (simple)
A.2.3.2. <jee:jndi-lookup/> (with single JNDI environment setting)
A.2.3.3. <jee:jndi-lookup/> (with multiple JNDI environment settings)
A.2.3.4. <jee:jndi-lookup/> (complex)
A.2.3.5. <jee:local-slsb/> (simple)
A.2.3.6. <jee:local-slsb/> (complex)
A.2.3.7. <jee:remote-slsb/>
A.2.4. The lang schema
A.2.5. The jms schema
A.2.6. The tx (transaction) schema
A.2.7. The aop schema
A.2.8. The context schema
A.2.8.1. <property-placeholder/>
A.2.8.2. <annotation-config/>
A.2.8.3. <component-scan/>
A.2.8.4. <load-time-weaver/>
A.2.8.5. <spring-configured/>
A.2.8.6. <mbean-export/>
A.2.9. The tool schema
A.2.10. The beans schema
A.3. Setting up your IDE
A.3.1. Setting up Eclipse
A.3.2. Setting up IntelliJ IDEA
A.3.3. Integration issues
A.3.3.1. XML parsing errors in the Resin v.3 application server
B. Extensible XML authoring
B.1. Introduction
B.2. Authoring the schema
B.3. Coding a NamespaceHandler
B.4. Coding a BeanDefinitionParser
B.5. Registering the handler and the schema
B.5.1. 'META-INF/spring.handlers'
B.5.2. 'META-INF/spring.schemas'
B.6. Using a custom extension in your Spring XML configuration
B.7. Meatier examples
B.7.1. Nesting custom tags within custom tags
B.7.2. Custom attributes on 'normal' elements
B.8. Further Resources
C. spring-beans-2.0.dtd
D. spring.tld
D.1. Introduction
D.2. The bind tag
D.3. The escapeBody tag
D.4. The hasBindErrors tag
D.5. The htmlEscape tag
D.6. The message tag
D.7. The nestedPath tag
D.8. The theme tag
D.9. The transform tag
E. spring-form.tld
E.1. Introduction
E.2. The checkbox tag
E.3. The checkboxes tag
E.4. The errors tag
E.5. The form tag
E.6. The hidden tag
E.7. The input tag
E.8. The label tag
E.9. The option tag
E.10. The options tag
E.11. The password tag
E.12. The radiobutton tag
E.13. The radiobuttons tag
E.14. The select tag
E.15. The textarea tag