Spring Framework

Reference Documentation

3.0

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

I. Overview of Spring Framework
1. Introduction to Spring Framework
1.1. Dependency Injection and Inversion of Control
1.2. Modules
1.2.1. Core Container
1.2.2. Data Access/Integration
1.2.3. Web
1.2.4. AOP and Instrumentation
1.2.5. Test
1.3. Usage scenarios
1.3.1. Dependency Management and Naming Conventions
1.3.1.1. Spring Dependencies and Depending on Spring
1.3.1.2. Maven Dependency Management
1.3.1.3. Ivy Dependency Management
1.3.2. Logging
1.3.2.1. Not Using Commons Logging
1.3.2.2. Using SLF4J
1.3.2.3. Using Log4J
II. What's New in Spring 3.0
2. New Features and Enhancements in Spring 3.0
2.1. Java 5
2.2. Improved documentation
2.3. New articles and tutorials
2.4. New module organization and build system
2.5. Overview of new features
2.5.1. Core APIs updated for Java 5
2.5.2. Spring Expression Language
2.5.3. The Inversion of Control (IoC) container
2.5.3.1. Java based bean metadata
2.5.3.2. Defining bean metadata within components
2.5.4. General purpose type conversion system and field formatting system
2.5.5. The Data Tier
2.5.6. The Web Tier
2.5.6.1. Comprehensive REST support
2.5.6.2. @MVC additions
2.5.7. Declarative model validation
2.5.8. Early support for Java EE 6
2.5.9. Support for embedded databases
III. Core Technologies
3. The IoC container
3.1. Introduction to the Spring IoC container and beans
3.2. Container overview
3.2.1. Configuration metadata
3.2.2. Instantiating a container
3.2.2.1. Composing XML-based configuration metadata
3.2.3. Using the container
3.3. Bean overview
3.3.1. Naming beans
3.3.1.1. Aliasing a bean outside the bean definition
3.3.2. Instantiating beans
3.3.2.1. Instantiation with a constructor
3.3.2.2. Instantiation with a static factory method
3.3.2.3. Instantiation using an instance factory method
3.4. Dependencies
3.4.1. Dependency injection
3.4.1.1. Constructor-based dependency injection
3.4.1.2. Setter-based dependency injection
3.4.1.3. Dependency resolution process
3.4.1.4. Examples of dependency injection
3.4.2. Dependencies and configuration in detail
3.4.2.1. Straight values (primitives, Strings, and so on)
3.4.2.2. References to other beans (collaborators)
3.4.2.3. Inner beans
3.4.2.4. Collections
3.4.2.5. Null and empty string values
3.4.2.6. XML shortcut with the p-namespace
3.4.2.7. Compound property names
3.4.3. Using depends-on
3.4.4. Lazy-initialized beans
3.4.5. Autowiring collaborators
3.4.5.1. Limitations and disadvantages of autowiring
3.4.5.2. Excluding a bean from autowiring
3.4.6. Method injection
3.4.6.1. Lookup method injection
3.4.6.2. Arbitrary method replacement
3.5. Bean scopes
3.5.1. The singleton scope
3.5.2. The prototype scope
3.5.3. Singleton beans with prototype-bean dependencies
3.5.4. Request, session, and global session scopes
3.5.4.1. Initial web configuration
3.5.4.2. Request scope
3.5.4.3. Session scope
3.5.4.4. Global session scope
3.5.4.5. Scoped beans as dependencies
3.5.5. Custom scopes
3.5.5.1. Creating a custom scope
3.5.5.2. Using a custom scope
3.6. Customizing the nature of a bean
3.6.1. Lifecycle callbacks
3.6.1.1. Initialization callbacks
3.6.1.2. Destruction callbacks
3.6.1.3. Default initialization and destroy methods
3.6.1.4. Combining lifecycle mechanisms
3.6.1.5. Startup and shutdown callbacks
3.6.1.6. Shutting down the Spring IoC container gracefully in non-web applications
3.6.2. ApplicationContextAware and BeanNameAware
3.6.3. Other Aware interfaces
3.7. Bean definition inheritance
3.8. Container extension points
3.8.1. Customizing beans using the BeanPostProcessor Interface
3.8.1.1. Example: Hello World, BeanPostProcessor-style
3.8.1.2. Example: The RequiredAnnotationBeanPostProcessor
3.8.2. Customizing configuration metadata with BeanFactoryPostProcessor interface
3.8.2.1. Example: the PropertyPlaceholderConfigurer
3.8.2.2. Example: the PropertyOverrideConfigurer
3.8.3. Customizing instantiation logic with the FactoryBean Interface
3.9. Annotation-based container configuration
3.9.1. @Required
3.9.2. @Autowired and @Inject
3.9.3. Fine-tuning annotation-based autowiring with qualifiers
3.9.4. CustomAutowireConfigurer
3.9.5. @Resource
3.9.6. @PostConstruct and @PreDestroy
3.10. Classpath scanning and managed components
3.10.1. @Component and further stereotype annotations
3.10.2. Automatically detecting classes and registering bean definitions
3.10.3. Using filters to customize scanning
3.10.4. Defining bean metadata within components
3.10.5. Naming autodetected components
3.10.6. Providing a scope for autodetected components
3.10.7. Providing qualifier metadata with annotations
3.11. Java-based container configuration
3.11.1. Basic concepts: @Configuration and @Bean
3.11.2. Instantiating the Spring container using AnnotationConfigApplicationContext
3.11.2.1. Simple construction
3.11.2.2. Building the container programmatically using register(Class<?>...)
3.11.2.3. Enabling component scanning with scan(String...)
3.11.2.4. Support for web applications with AnnotationConfigWebApplicationContext
3.11.3. Composing Java-based configurations
3.11.3.1. Using the @Import annotation
3.11.3.2. Combining Java and XML configuration
3.11.4. Using the @Bean annotation
3.11.4.1. Declaring a bean
3.11.4.2. Injecting dependencies
3.11.4.3. Receiving lifecycle callbacks
3.11.4.4. Specifying bean scope
3.11.4.5. Customizing bean naming
3.11.4.6. Bean aliasing
3.11.5. Further information about how Java-based configuration works internally
3.12. Registering a LoadTimeWeaver
3.13. Additional Capabilities of the ApplicationContext
3.13.1. Internationalization using MessageSource
3.13.2. Standard and Custom Events
3.13.3. Convenient access to low-level resources
3.13.4. Convenient ApplicationContext instantiation for web applications
3.13.5. Deploying a Spring ApplicationContext as a J2EE RAR file
3.14. The BeanFactory
3.14.1. BeanFactory or ApplicationContext?
3.14.2. Glue code and the evil singleton
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, and Type Conversion
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
5.5. Spring 3 Type Conversion
5.5.1. Converter SPI
5.5.2. ConverterFactory
5.5.3. GenericConverter
5.5.3.1. ConditionalGenericConverter
5.5.4. ConversionService API
5.5.5. Configuring a ConversionService
5.5.6. Using a ConversionService programatically
5.6. Spring 3 Field Formatting
5.6.1. Formatter SPI
5.6.2. Annotation-driven Formatting
5.6.2.1. Format Annotation API
5.6.3. FormatterRegistry SPI
5.6.4. Configuring Formatting in Spring MVC
5.7. Spring 3 Validation
5.7.1. Overview of the JSR-303 Bean Validation API
5.7.2. Configuring a Bean Validation Implementation
5.7.2.1. Injecting a Validator
5.7.2.2. Configuring Custom Constraints
5.7.2.3. Additional Configuration Options
5.7.3. Configuring a DataBinder
5.7.4. Spring MVC 3 Validation
5.7.4.1. Triggering @Controller Input Validation
5.7.4.2. Configuring a Validator for use by Spring MVC
5.7.4.3. Configuring a JSR-303 Validator for use by Spring MVC
6. Spring Expression Language (SpEL)
6.1. Introduction
6.2. Feature Overview
6.3. Expression Evaluation using Spring's Expression Interface
6.3.1. The EvaluationContext interface
6.3.1.1. Type Conversion
6.4. Expression support for defining bean definitions
6.4.1. XML based configuration
6.4.2. Annotation-based configuration
6.5. Language Reference
6.5.1. Literal expressions
6.5.2. Properties, Arrays, Lists, Maps, Indexers
6.5.3. Inline lists
6.5.4. Array construction
6.5.5. Methods
6.5.6. Operators
6.5.6.1. Relational operators
6.5.6.2. Logical operators
6.5.6.3. Mathematical operators
6.5.7. Assignment
6.5.8. Types
6.5.9. Constructors
6.5.10. Variables
6.5.10.1. The #this and #root variables
6.5.11. Functions
6.5.12. Bean references
6.5.13. Ternary Operator (If-Then-Else)
6.5.14. The Elvis Operator
6.5.15. Safe Navigation operator
6.5.16. Collection Selection
6.5.17. Collection Projection
6.5.18. Expression templating
6.6. Classes used in the examples
7. Aspect Oriented Programming with Spring
7.1. Introduction
7.1.1. AOP concepts
7.1.2. Spring AOP capabilities and goals
7.1.3. AOP Proxies
7.2. @AspectJ support
7.2.1. Enabling @AspectJ Support
7.2.2. Declaring an aspect
7.2.3. Declaring a pointcut
7.2.3.1. Supported Pointcut Designators
7.2.3.2. Combining pointcut expressions
7.2.3.3. Sharing common pointcut definitions
7.2.3.4. Examples
7.2.3.5. Writing good pointcuts
7.2.4. Declaring advice
7.2.4.1. Before advice
7.2.4.2. After returning advice
7.2.4.3. After throwing advice
7.2.4.4. After (finally) advice
7.2.4.5. Around advice
7.2.4.6. Advice parameters
7.2.4.7. Advice ordering
7.2.5. Introductions
7.2.6. Aspect instantiation models
7.2.7. Example
7.3. Schema-based AOP support
7.3.1. Declaring an aspect
7.3.2. Declaring a pointcut
7.3.3. Declaring advice
7.3.3.1. Before advice
7.3.3.2. After returning advice
7.3.3.3. After throwing advice
7.3.3.4. After (finally) advice
7.3.3.5. Around advice
7.3.3.6. Advice parameters
7.3.3.7. Advice ordering
7.3.4. Introductions
7.3.5. Aspect instantiation models
7.3.6. Advisors
7.3.7. Example
7.4. Choosing which AOP declaration style to use
7.4.1. Spring AOP or full AspectJ?
7.4.2. @AspectJ or XML for Spring AOP?
7.5. Mixing aspect types
7.6. Proxying mechanisms
7.6.1. Understanding AOP proxies
7.7. Programmatic creation of @AspectJ Proxies
7.8. Using AspectJ with Spring applications
7.8.1. Using AspectJ to dependency inject domain objects with Spring
7.8.1.1. Unit testing @Configurable objects
7.8.1.2. Working with multiple application contexts
7.8.2. Other Spring aspects for AspectJ
7.8.3. Configuring AspectJ aspects using Spring IoC
7.8.4. Load-time weaving with AspectJ in the Spring Framework
7.8.4.1. A first example
7.8.4.2. Aspects
7.8.4.3. 'META-INF/aop.xml'
7.8.4.4. Required libraries (JARS)
7.8.4.5. Spring configuration
7.8.4.6. Environment-specific configuration
7.9. Further Resources
8. Spring AOP APIs
8.1. Introduction
8.2. Pointcut API in Spring
8.2.1. Concepts
8.2.2. Operations on pointcuts
8.2.3. AspectJ expression pointcuts
8.2.4. Convenience pointcut implementations
8.2.4.1. Static pointcuts
8.2.4.2. Dynamic pointcuts
8.2.5. Pointcut superclasses
8.2.6. Custom pointcuts
8.3. Advice API in Spring
8.3.1. Advice lifecycles
8.3.2. Advice types in Spring
8.3.2.1. Interception around advice
8.3.2.2. Before advice
8.3.2.3. Throws advice
8.3.2.4. After Returning advice
8.3.2.5. Introduction advice
8.4. Advisor API in Spring
8.5. Using the ProxyFactoryBean to create AOP proxies
8.5.1. Basics
8.5.2. JavaBean properties
8.5.3. JDK- and CGLIB-based proxies
8.5.4. Proxying interfaces
8.5.5. Proxying classes
8.5.6. Using 'global' advisors
8.6. Concise proxy definitions
8.7. Creating AOP proxies programmatically with the ProxyFactory
8.8. Manipulating advised objects
8.9. Using the "autoproxy" facility
8.9.1. Autoproxy bean definitions
8.9.1.1. BeanNameAutoProxyCreator
8.9.1.2. DefaultAdvisorAutoProxyCreator
8.9.1.3. AbstractAdvisorAutoProxyCreator
8.9.2. Using metadata-driven auto-proxying
8.10. Using TargetSources
8.10.1. Hot swappable target sources
8.10.2. Pooling target sources
8.10.3. Prototype target sources
8.10.4. ThreadLocal target sources
8.11. Defining new Advice types
8.12. Further resources
9. Testing
9.1. Introduction to testing
9.2. Unit testing
9.2.1. Mock objects
9.2.1.1. JNDI
9.2.1.2. Servlet API
9.2.1.3. Portlet API
9.2.2. Unit testing support classes
9.2.2.1. General utilities
9.2.2.2. Spring MVC
9.3. Integration testing
9.3.1. Overview
9.3.2. Goals of integration testing
9.3.2.1. Context management and caching
9.3.2.2. Dependency Injection of test fixtures
9.3.2.3. Transaction management
9.3.2.4. Support classes for integration testing
9.3.3. JDBC testing support
9.3.4. Annotations
9.3.5. Spring TestContext Framework
9.3.5.1. Key abstractions
9.3.5.2. Context management and caching
9.3.5.3. Dependency Injection of test fixtures
9.3.5.4. Transaction management
9.3.5.5. TestContext support classes
9.3.6. PetClinic example
9.4. Further Resources
IV. Data Access
10. Transaction Management
10.1. Introduction to Spring Framework transaction management
10.2. Advantages of the Spring Framework's transaction support model
10.2.1. Global transactions
10.2.2. Local transactions
10.2.3. Spring Framework's consistent programming model
10.3. Understanding the Spring Framework transaction abstraction
10.4. Synchronizing resources with transactions
10.4.1. High-level synchronization approach
10.4.2. Low-level synchronization approach
10.4.3. TransactionAwareDataSourceProxy
10.5. Declarative transaction management
10.5.1. Understanding the Spring Framework's declarative transaction implementation
10.5.2. Example of declarative transaction implementation
10.5.3. Rolling back a declarative transaction
10.5.4. Configuring different transactional semantics for different beans
10.5.5. <tx:advice/> settings
10.5.6. Using @Transactional
10.5.6.1. @Transactional settings
10.5.6.2. Multiple Transaction Managers with @Transactional
10.5.6.3. Custom shortcut annotations
10.5.7. Transaction propagation
10.5.7.1. Required
10.5.7.2. RequiresNew
10.5.7.3. Nested
10.5.8. Advising transactional operations
10.5.9. Using @Transactional with AspectJ
10.6. Programmatic transaction management
10.6.1. Using the TransactionTemplate
10.6.1.1. Specifying transaction settings
10.6.2. Using the PlatformTransactionManager
10.7. Choosing between programmatic and declarative transaction management
10.8. Application server-specific integration
10.8.1. IBM WebSphere
10.8.2. BEA WebLogic Server
10.8.3. Oracle OC4J
10.9. Solutions to common problems
10.9.1. Use of the wrong transaction manager for a specific DataSource
10.10. Further Resources
11. DAO support
11.1. Introduction
11.2. Consistent exception hierarchy
11.3. Annotations used for configuring DAO or Repository classes
12. Data access with JDBC
12.1. Introduction to Spring Framework JDBC
12.1.1. Choosing an approach for JDBC database access
12.1.2. Package hierarchy
12.2. Using the JDBC core classes to control basic JDBC processing and error handling
12.2.1. JdbcTemplate
12.2.1.1. Examples of JdbcTemplate class usage
12.2.1.2. JdbcTemplate best practices
12.2.2. NamedParameterJdbcTemplate
12.2.3. SimpleJdbcTemplate
12.2.4. SQLExceptionTranslator
12.2.5. Executing statements
12.2.6. Running queries
12.2.7. Updating the database
12.2.8. Retrieving auto-generated keys
12.3. Controlling database connections
12.3.1. DataSource
12.3.2. DataSourceUtils
12.3.3. SmartDataSource
12.3.4. AbstractDataSource
12.3.5. SingleConnectionDataSource
12.3.6. DriverManagerDataSource
12.3.7. TransactionAwareDataSourceProxy
12.3.8. DataSourceTransactionManager
12.3.9. NativeJdbcExtractor
12.4. JDBC batch operations
12.4.1. Batch operations with the JdbcTemplate
12.4.2. Batch operations with the SimpleJdbcTemplate
12.5. Simplifying JDBC operations with the SimpleJdbc classes
12.5.1. Inserting data using SimpleJdbcInsert
12.5.2. Retrieving auto-generated keys using SimpleJdbcInsert
12.5.3. Specifying columns for a SimpleJdbcInsert
12.5.4. Using SqlParameterSource to provide parameter values
12.5.5. Calling a stored procedure with SimpleJdbcCall
12.5.6. Explicitly declaring parameters to use for a SimpleJdbcCall
12.5.7. How to define SqlParameters
12.5.8. Calling a stored function using SimpleJdbcCall
12.5.9. Returning ResultSet/REF Cursor from a SimpleJdbcCall
12.6. Modeling JDBC operations as Java objects
12.6.1. SqlQuery
12.6.2. MappingSqlQuery
12.6.3. SqlUpdate
12.6.4. StoredProcedure
12.7. Common problems with parameter and data value handling
12.7.1. Providing SQL type information for parameters
12.7.2. Handling BLOB and CLOB objects
12.7.3. Passing in lists of values for IN clause
12.7.4. Handling complex types for stored procedure calls
12.8. Embedded database support
12.8.1. Why use an embedded database?
12.8.2. Creating an embedded database instance using Spring XML
12.8.3. Creating an embedded database instance programmatically
12.8.4. Extending the embedded database support
12.8.5. Using HSQL
12.8.6. Using H2
12.8.7. Using Derby
12.8.8. Testing data access logic with an embedded database
12.9. Initializing a DataSource
12.9.1. Initializing a database instance using Spring XML
12.9.1.1. Initialization of Other Components that Depend on the Database
13. Object Relational Mapping (ORM) Data Access
13.1. Introduction to ORM with Spring
13.2. General ORM integration considerations
13.2.1. Resource and transaction management
13.2.2. Exception translation
13.3. Hibernate
13.3.1. SessionFactory setup in a Spring container
13.3.2. Implementing DAOs based on plain Hibernate 3 API
13.3.3. Declarative transaction demarcation
13.3.4. Programmatic transaction demarcation
13.3.5. Transaction management strategies
13.3.6. Comparing container-managed and locally defined resources
13.3.7. Spurious application server warnings with Hibernate
13.4. JDO
13.4.1. PersistenceManagerFactory setup
13.4.2. Implementing DAOs based on the plain JDO API
13.4.3. Transaction management
13.4.4. JdoDialect
13.5. JPA
13.5.1. Three options for JPA setup in a Spring environment
13.5.1.1. LocalEntityManagerFactoryBean
13.5.1.2. Obtaining an EntityManagerFactory from JNDI
13.5.1.3. LocalContainerEntityManagerFactoryBean
13.5.1.4. Dealing with multiple persistence units
13.5.2. Implementing DAOs based on plain JPA
13.5.3. Transaction Management
13.5.4. JpaDialect
13.6. iBATIS SQL Maps
13.6.1. Setting up the SqlMapClient
13.6.2. Using SqlMapClientTemplate and SqlMapClientDaoSupport
13.6.3. Implementing DAOs based on plain iBATIS API
14. Marshalling XML using O/X Mappers
14.1. Introduction
14.2. Marshaller and Unmarshaller
14.2.1. Marshaller
14.2.2. Unmarshaller
14.2.3. XmlMappingException
14.3. Using Marshaller and Unmarshaller
14.4. XML Schema-based Configuration
14.5. JAXB
14.5.1. Jaxb2Marshaller
14.5.1.1. XML Schema-based Configuration
14.6. Castor
14.6.1. CastorMarshaller
14.6.2. Mapping
14.7. XMLBeans
14.7.1. XmlBeansMarshaller
14.7.1.1. XML Schema-based Configuration
14.8. JiBX
14.8.1. JibxMarshaller
14.8.1.1. XML Schema-based Configuration
14.9. XStream
14.9.1. XStreamMarshaller
V. The Web
15. Web MVC framework
15.1. Introduction to Spring Web MVC framework
15.1.1. Features of Spring Web MVC
15.1.2. Pluggability of other MVC implementations
15.2. The DispatcherServlet
15.3. Implementing Controllers
15.3.1. Defining a controller with @Controller
15.3.2. Mapping requests with @RequestMapping
15.3.2.1. URI Templates
15.3.2.2. Advanced @RequestMapping options
15.3.2.3. Supported handler method arguments and return types
15.3.2.4. Binding request parameters to method parameters with @RequestParam
15.3.2.5. Mapping the request body with the @RequestBody annotation
15.3.2.6. Mapping the response body with the @ResponseBody annotation
15.3.2.7. Using HttpEntity<?>
15.3.2.8. Providing a link to data from the model with @ModelAttribute
15.3.2.9. Specifying attributes to store in a session with @SessionAttributes
15.3.2.10. Mapping cookie values with the @CookieValue annotation
15.3.2.11. Mapping request header attributes with the @RequestHeader annotation
15.3.2.12. Customizing WebDataBinder initialization
15.4. Handler mappings
15.4.1. Intercepting requests - the HandlerInterceptor interface
15.5. Resolving views
15.5.1. Resolving views with the ViewResolver interface
15.5.2. Chaining ViewResolvers
15.5.3. Redirecting to views
15.5.3.1. RedirectView
15.5.3.2. The redirect: prefix
15.5.3.3. The forward: prefix
15.5.4. ContentNegotiatingViewResolver
15.6. Using locales
15.6.1. AcceptHeaderLocaleResolver
15.6.2. CookieLocaleResolver
15.6.3. SessionLocaleResolver
15.6.4. LocaleChangeInterceptor
15.7. Using themes
15.7.1. Overview of themes
15.7.2. Defining themes
15.7.3. Theme resolvers
15.8. Spring's multipart (fileupload) support
15.8.1. Introduction
15.8.2. Using the MultipartResolver
15.8.3. Handling a file upload in a form
15.9. Handling exceptions
15.9.1. HandlerExceptionResolver
15.9.2. @ExceptionHandler
15.10. Convention over configuration support
15.10.1. The Controller ControllerClassNameHandlerMapping
15.10.2. The Model ModelMap (ModelAndView)
15.10.3. The View - RequestToViewNameTranslator
15.11. ETag support
15.12. Configuring Spring MVC
15.12.1. mvc:annotation-driven
15.12.2. mvc:interceptors
15.12.3. mvc:view-controller
15.12.4. mvc:resources
15.12.5. mvc:default-servlet-handler
15.13. More Spring Web MVC Resources
16. View technologies
16.1. Introduction
16.2. JSP & JSTL
16.2.1. View resolvers
16.2.2. 'Plain-old' JSPs versus JSTL
16.2.3. Additional tags facilitating development
16.2.4. Using Spring's form tag library
16.2.4.1. Configuration
16.2.4.2. The form tag
16.2.4.3. The input tag
16.2.4.4. The checkbox tag
16.2.4.5. The checkboxes tag
16.2.4.6. The radiobutton tag
16.2.4.7. The radiobuttons tag
16.2.4.8. The password tag
16.2.4.9. The select tag
16.2.4.10. The option tag
16.2.4.11. The options tag
16.2.4.12. The textarea tag
16.2.4.13. The hidden tag
16.2.4.14. The errors tag
16.2.4.15. HTTP Method Conversion
16.3. Tiles
16.3.1. Dependencies
16.3.2. How to integrate Tiles
16.3.2.1. UrlBasedViewResolver
16.3.2.2. ResourceBundleViewResolver
16.3.2.3. SimpleSpringPreparerFactory and SpringBeanPreparerFactory
16.4. Velocity & FreeMarker
16.4.1. Dependencies
16.4.2. Context configuration
16.4.3. Creating templates
16.4.4. Advanced configuration
16.4.4.1. velocity.properties
16.4.4.2. FreeMarker
16.4.5. Bind support and form handling
16.4.5.1. The bind macros
16.4.5.2. Simple binding
16.4.5.3. Form input generation macros
16.4.5.4. HTML escaping and XHTML compliance
16.5. XSLT
16.5.1. My First Words
16.5.1.1. Bean definitions
16.5.1.2. Standard MVC controller code
16.5.1.3. Convert the model data to XML
16.5.1.4. Defining the view properties
16.5.1.5. Document transformation
16.5.2. Summary
16.6. Document views (PDF/Excel)
16.6.1. Introduction
16.6.2. Configuration and setup
16.6.2.1. Document view definitions
16.6.2.2. Controller code
16.6.2.3. Subclassing for Excel views
16.6.2.4. Subclassing for PDF views
16.7. JasperReports
16.7.1. Dependencies
16.7.2. Configuration
16.7.2.1. Configuring the ViewResolver
16.7.2.2. Configuring the Views
16.7.2.3. About Report Files
16.7.2.4. Using JasperReportsMultiFormatView
16.7.3. Populating the ModelAndView
16.7.4. Working with Sub-Reports
16.7.4.1. Configuring Sub-Report Files
16.7.4.2. Configuring Sub-Report Data Sources
16.7.5. Configuring Exporter Parameters
16.8. Feed Views
16.9. XML Marshalling View
16.10. JSON Mapping View
17. Integrating with other web frameworks
17.1. Introduction
17.2. Common configuration
17.3. JavaServer Faces 1.1 and 1.2
17.3.1. DelegatingVariableResolver (JSF 1.1/1.2)
17.3.2. SpringBeanVariableResolver (JSF 1.1/1.2)
17.3.3. SpringBeanFacesELResolver (JSF 1.2+)
17.3.4. FacesContextUtils
17.4. Apache Struts 1.x and 2.x
17.4.1. ContextLoaderPlugin
17.4.1.1. DelegatingRequestProcessor
17.4.1.2. DelegatingActionProxy
17.4.2. ActionSupport Classes
17.5. WebWork 2.x
17.6. Tapestry 3.x and 4.x
17.6.1. Injecting Spring-managed beans
17.6.1.1. Dependency Injecting Spring Beans into Tapestry pages
17.6.1.2. Component definition files
17.6.1.3. Adding abstract accessors
17.6.1.4. Dependency Injecting Spring Beans into Tapestry pages - Tapestry 4.x style
17.7. Further Resources
18. Portlet MVC Framework
18.1. Introduction
18.1.1. Controllers - The C in MVC
18.1.2. Views - The V in MVC
18.1.3. Web-scoped beans
18.2. The DispatcherPortlet
18.3. The ViewRendererServlet
18.4. Controllers
18.4.1. AbstractController and PortletContentGenerator
18.4.2. Other simple controllers
18.4.3. Command Controllers
18.4.4. PortletWrappingController
18.5. Handler mappings
18.5.1. PortletModeHandlerMapping
18.5.2. ParameterHandlerMapping
18.5.3. PortletModeParameterHandlerMapping
18.5.4. Adding HandlerInterceptors
18.5.5. HandlerInterceptorAdapter
18.5.6. ParameterMappingInterceptor
18.6. Views and resolving them
18.7. Multipart (file upload) support
18.7.1. Using the PortletMultipartResolver
18.7.2. Handling a file upload in a form
18.8. Handling exceptions
18.9. Annotation-based controller configuration
18.9.1. Setting up the dispatcher for annotation support
18.9.2. Defining a controller with @Controller
18.9.3. Mapping requests with @RequestMapping
18.9.4. Supported handler method arguments
18.9.5. Binding request parameters to method parameters with @RequestParam
18.9.6. Providing a link to data from the model with @ModelAttribute
18.9.7. Specifying attributes to store in a Session with @SessionAttributes
18.9.8. Customizing WebDataBinder initialization
18.9.8.1. Customizing data binding with @InitBinder
18.9.8.2. Configuring a custom WebBindingInitializer
18.10. Portlet application deployment
VI. Integration
19. Remoting and web services using Spring
19.1. Introduction
19.2. Exposing services using RMI
19.2.1. Exporting the service using the RmiServiceExporter
19.2.2. Linking in the service at the client
19.3. Using Hessian or Burlap to remotely call services via HTTP
19.3.1. Wiring up the DispatcherServlet for Hessian and co.
19.3.2. Exposing your beans by using the HessianServiceExporter
19.3.3. Linking in the service on the client
19.3.4. Using Burlap
19.3.5. Applying HTTP basic authentication to a service exposed through Hessian or Burlap
19.4. Exposing services using HTTP invokers
19.4.1. Exposing the service object
19.4.2. Linking in the service at the client
19.5. Web services
19.5.1. Exposing servlet-based web services using JAX-RPC
19.5.2. Accessing web services using JAX-RPC
19.5.3. Registering JAX-RPC Bean Mappings
19.5.4. Registering your own JAX-RPC Handler
19.5.5. Exposing servlet-based web services using JAX-WS
19.5.6. Exporting standalone web services using JAX-WS
19.5.7. Exporting web services using the JAX-WS RI's Spring support
19.5.8. Accessing web services using JAX-WS
19.6. JMS
19.6.1. Server-side configuration
19.6.2. Client-side configuration
19.7. Auto-detection is not implemented for remote interfaces
19.8. Considerations when choosing a technology
19.9. Accessing RESTful services on the Client
19.9.1. RestTemplate
19.9.1.1. Dealing with request and response headers
19.9.2. HTTP Message Conversion
19.9.2.1. StringHttpMessageConverter
19.9.2.2. FormHttpMessageConverter
19.9.2.3. ByteArrayMessageConverter
19.9.2.4. MarshallingHttpMessageConverter
19.9.2.5. MappingJacksonHttpMessageConverter
19.9.2.6. SourceHttpMessageConverter
19.9.2.7. BufferedImageHttpMessageConverter
20. Enterprise JavaBeans (EJB) integration
20.1. Introduction
20.2. Accessing EJBs
20.2.1. Concepts
20.2.2. Accessing local SLSBs
20.2.3. Accessing remote SLSBs
20.2.4. Accessing EJB 2.x SLSBs versus EJB 3 SLSBs
20.3. Using Spring's EJB implementation support classes
20.3.1. EJB 2.x base classes
20.3.2. EJB 3 injection interceptor
21. JMS (Java Message Service)
21.1. Introduction
21.2. Using Spring JMS
21.2.1. JmsTemplate
21.2.2. Connections
21.2.2.1. Caching Messaging Resources
21.2.2.2. SingleConnectionFactory
21.2.2.3. CachingConnectionFactory
21.2.3. Destination Management
21.2.4. Message Listener Containers
21.2.4.1. SimpleMessageListenerContainer
21.2.4.2. DefaultMessageListenerContainer
21.2.5. Transaction management
21.3. Sending a Message
21.3.1. Using Message Converters
21.3.2. SessionCallback and ProducerCallback
21.4. Receiving a message
21.4.1. Synchronous Reception
21.4.2. Asynchronous Reception - Message-Driven POJOs
21.4.3. The SessionAwareMessageListener interface
21.4.4. The MessageListenerAdapter
21.4.5. Processing messages within transactions
21.5. Support for JCA Message Endpoints
21.6. JMS Namespace Support
22. JMX
22.1. Introduction
22.2. Exporting your beans to JMX
22.2.1. Creating an MBeanServer
22.2.2. Reusing an existing MBeanServer
22.2.3. Lazy-initialized MBeans
22.2.4. Automatic registration of MBeans
22.2.5. Controlling the registration behavior
22.3. Controlling the management interface of your beans
22.3.1. The MBeanInfoAssembler Interface
22.3.2. Using Source-Level Metadata (JDK 5.0 annotations)
22.3.3. Source-Level Metadata Types
22.3.4. The AutodetectCapableMBeanInfoAssembler interface
22.3.5. Defining management interfaces using Java interfaces
22.3.6. Using MethodNameBasedMBeanInfoAssembler
22.4. Controlling the ObjectNames for your beans
22.4.1. Reading ObjectNames from Properties
22.4.2. Using the MetadataNamingStrategy
22.4.3. The <context:mbean-export/> element
22.5. JSR-160 Connectors
22.5.1. Server-side Connectors
22.5.2. Client-side Connectors
22.5.3. JMX over Burlap/Hessian/SOAP
22.6. Accessing MBeans via Proxies
22.7. Notifications
22.7.1. Registering Listeners for Notifications
22.7.2. Publishing Notifications
22.8. Further Resources
23. JCA CCI
23.1. Introduction
23.2. Configuring CCI
23.2.1. Connector configuration
23.2.2. ConnectionFactory configuration in Spring
23.2.3. Configuring CCI connections
23.2.4. Using a single CCI connection
23.3. Using Spring's CCI access support
23.3.1. Record conversion
23.3.2. The CciTemplate
23.3.3. DAO support
23.3.4. Automatic output record generation
23.3.5. Summary
23.3.6. Using a CCI Connection and Interaction directly
23.3.7. Example for CciTemplate usage
23.4. Modeling CCI access as operation objects
23.4.1. MappingRecordOperation
23.4.2. MappingCommAreaOperation
23.4.3. Automatic output record generation
23.4.4. Summary
23.4.5. Example for MappingRecordOperation usage
23.4.6. Example for MappingCommAreaOperation usage
23.5. Transactions
24. Email
24.1. Introduction
24.2. Usage
24.2.1. Basic MailSender and SimpleMailMessage usage
24.2.2. Using the JavaMailSender and the MimeMessagePreparator
24.3. Using the JavaMail MimeMessageHelper
24.3.1. Sending attachments and inline resources
24.3.1.1. Attachments
24.3.1.2. Inline resources
24.3.2. Creating email content using a templating library
24.3.2.1. A Velocity-based example
25. Task Execution and Scheduling
25.1. Introduction
25.2. The Spring TaskExecutor abstraction
25.2.1. TaskExecutor types
25.2.2. Using a TaskExecutor
25.3. The Spring TaskScheduler abstraction
25.3.1. The Trigger interface
25.3.2. Trigger implementations
25.3.3. TaskScheduler implementations
25.4. The Task Namespace
25.4.1. The 'scheduler' element
25.4.2. The 'executor' element
25.4.3. The 'scheduled-tasks' element
25.5. Annotation Support for Scheduling and Asynchronous Execution
25.5.1. The @Scheduled Annotation
25.5.2. The @Async Annotation
25.5.3. The <annotation-driven> Element
25.6. Using the OpenSymphony Quartz Scheduler
25.6.1. Using the JobDetailBean
25.6.2. Using the MethodInvokingJobDetailFactoryBean
25.6.3. Wiring up jobs using triggers and the SchedulerFactoryBean
25.7. Using JDK Timer support
25.7.1. Creating custom timers
25.7.2. Using the MethodInvokingTimerTaskFactoryBean
25.7.3. Wrapping up: setting up the tasks using the TimerFactoryBean
26. Dynamic language support
26.1. Introduction
26.2. A first example
26.3. Defining beans that are backed by dynamic languages
26.3.1. Common concepts
26.3.1.1. The <lang:language/> element
26.3.1.2. Refreshable beans
26.3.1.3. Inline dynamic language source files
26.3.1.4. Understanding Constructor Injection in the context of dynamic-language-backed beans
26.3.2. JRuby beans
26.3.3. Groovy beans
26.3.3.1. Customising Groovy objects via a callback
26.3.4. BeanShell beans
26.4. Scenarios
26.4.1. Scripted Spring MVC Controllers
26.4.2. Scripted Validators
26.5. Bits and bobs
26.5.1. AOP - advising scripted beans
26.5.2. Scoping
26.6. Further Resources
VII. Appendices
A. Classic Spring Usage
A.1. Classic ORM usage
A.1.1. Hibernate
A.1.1.1. The HibernateTemplate
A.1.1.2. Implementing Spring-based DAOs without callbacks
A.1.2. JDO
A.1.2.1. JdoTemplate and JdoDaoSupport
A.1.3. JPA
A.1.3.1. JpaTemplate and JpaDaoSupport
A.2. Classic Spring MVC
A.3. JMS Usage
A.3.1. JmsTemplate
A.3.2. Asynchronous Message Reception
A.3.3. Connections
A.3.4. Transaction Management
B. Classic Spring AOP Usage
B.1. Pointcut API in Spring
B.1.1. Concepts
B.1.2. Operations on pointcuts
B.1.3. AspectJ expression pointcuts
B.1.4. Convenience pointcut implementations
B.1.4.1. Static pointcuts
B.1.4.2. Dynamic pointcuts
B.1.5. Pointcut superclasses
B.1.6. Custom pointcuts
B.2. Advice API in Spring
B.2.1. Advice lifecycles
B.2.2. Advice types in Spring
B.2.2.1. Interception around advice
B.2.2.2. Before advice
B.2.2.3. Throws advice
B.2.2.4. After Returning advice
B.2.2.5. Introduction advice
B.3. Advisor API in Spring
B.4. Using the ProxyFactoryBean to create AOP proxies
B.4.1. Basics
B.4.2. JavaBean properties
B.4.3. JDK- and CGLIB-based proxies
B.4.4. Proxying interfaces
B.4.5. Proxying classes
B.4.6. Using 'global' advisors
B.5. Concise proxy definitions
B.6. Creating AOP proxies programmatically with the ProxyFactory
B.7. Manipulating advised objects
B.8. Using the "autoproxy" facility
B.8.1. Autoproxy bean definitions
B.8.1.1. BeanNameAutoProxyCreator
B.8.1.2. DefaultAdvisorAutoProxyCreator
B.8.1.3. AbstractAdvisorAutoProxyCreator
B.8.2. Using metadata-driven auto-proxying
B.9. Using TargetSources
B.9.1. Hot swappable target sources
B.9.2. Pooling target sources
B.9.3. Prototype target sources
B.9.4. ThreadLocal target sources
B.10. Defining new Advice types
B.11. Further resources
C. XML Schema-based configuration
C.1. Introduction
C.2. XML Schema-based configuration
C.2.1. Referencing the schemas
C.2.2. The util schema
C.2.2.1. <util:constant/>
C.2.2.2. <util:property-path/>
C.2.2.3. <util:properties/>
C.2.2.4. <util:list/>
C.2.2.5. <util:map/>
C.2.2.6. <util:set/>
C.2.3. The jee schema
C.2.3.1. <jee:jndi-lookup/> (simple)
C.2.3.2. <jee:jndi-lookup/> (with single JNDI environment setting)
C.2.3.3. <jee:jndi-lookup/> (with multiple JNDI environment settings)
C.2.3.4. <jee:jndi-lookup/> (complex)
C.2.3.5. <jee:local-slsb/> (simple)
C.2.3.6. <jee:local-slsb/> (complex)
C.2.3.7. <jee:remote-slsb/>
C.2.4. The lang schema
C.2.5. The jms schema
C.2.6. The tx (transaction) schema
C.2.7. The aop schema
C.2.8. The context schema
C.2.8.1. <property-placeholder/>
C.2.8.2. <annotation-config/>
C.2.8.3. <component-scan/>
C.2.8.4. <load-time-weaver/>
C.2.8.5. <spring-configured/>
C.2.8.6. <mbean-export/>
C.2.9. The tool schema
C.2.10. The beans schema
D. Extensible XML authoring
D.1. Introduction
D.2. Authoring the schema
D.3. Coding a NamespaceHandler
D.4. Coding a BeanDefinitionParser
D.5. Registering the handler and the schema
D.5.1. 'META-INF/spring.handlers'
D.5.2. 'META-INF/spring.schemas'
D.6. Using a custom extension in your Spring XML configuration
D.7. Meatier examples
D.7.1. Nesting custom tags within custom tags
D.7.2. Custom attributes on 'normal' elements
D.8. Further Resources
E. spring-beans-2.0.dtd
F. spring.tld
F.1. Introduction
F.2. The bind tag
F.3. The escapeBody tag
F.4. The hasBindErrors tag
F.5. The htmlEscape tag
F.6. The message tag
F.7. The nestedPath tag
F.8. The theme tag
F.9. The transform tag
F.10. The url tag
F.11. The eval tag
G. spring-form.tld
G.1. Introduction
G.2. The checkbox tag
G.3. The checkboxes tag
G.4. The errors tag
G.5. The form tag
G.6. The hidden tag
G.7. The input tag
G.8. The label tag
G.9. The option tag
G.10. The options tag
G.11. The password tag
G.12. The radiobutton tag
G.13. The radiobuttons tag
G.14. The select tag
G.15. The textarea tag