On this page
Spring Framework Reference Documentation
Authors
Rod Johnson , Juergen Hoeller , Keith Donald , Colin Sampaleanu , Rob Harrop , Thomas Risberg , Alef Arendsen , 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 , Chris Beams , Tareq Abedrabbo , Andy Clement , Dave Syer , Oliver Gierke , Rossen Stoyanchev , Phillip Webb , Rob Winch , Brian Clozel , Stephane Nicoll , Sebastien Deleuze4.3.21.RELEASE
Copyright © 2004-2016
Table of Contents
- I. Overview of Spring Framework
- II. What’s New in Spring Framework 4.x
-
- 3. New Features and Enhancements in Spring Framework 4.0
-
- 3.1. Improved Getting Started Experience
- 3.2. Removed Deprecated Packages and Methods
- 3.3. Java 8 (as well as 6 and 7)
- 3.4. Java EE 6 and 7
- 3.5. Groovy Bean Definition DSL
- 3.6. Core Container Improvements
- 3.7. General Web Improvements
- 3.8. WebSocket, SockJS, and STOMP Messaging
- 3.9. Testing Improvements
- 4. New Features and Enhancements in Spring Framework 4.1
- 5. New Features and Enhancements in Spring Framework 4.2
- 6. New Features and Enhancements in Spring Framework 4.3
- III. Core Technologies
-
- 7. The IoC container
-
- 7.1. Introduction to the Spring IoC container and beans
- 7.2. Container overview
- 7.3. Bean overview
- 7.4. Dependencies
- 7.5. Bean scopes
- 7.6. Customizing the nature of a bean
- 7.7. Bean definition inheritance
- 7.8. Container Extension Points
- 7.9. Annotation-based container configuration
- 7.10. Classpath scanning and managed components
-
- 7.10.1. @Component and further stereotype annotations
- 7.10.2. Meta-annotations
- 7.10.3. Automatically detecting classes and registering bean definitions
- 7.10.4. Using filters to customize scanning
- 7.10.5. Defining bean metadata within components
- 7.10.6. Naming autodetected components
- 7.10.7. Providing a scope for autodetected components
- 7.10.8. Providing qualifier metadata with annotations
- 7.11. Using JSR 330 Standard Annotations
- 7.12. Java-based container configuration
- 7.13. Environment abstraction
- 7.14. Registering a LoadTimeWeaver
- 7.15. Additional capabilities of the ApplicationContext
- 7.16. The BeanFactory
- 8. Resources
- 9. Validation, Data Binding, and Type Conversion
- 10. Spring Expression Language (SpEL)
-
- 10.1. Introduction
- 10.2. Evaluation
- 10.3. Expressions in bean definitions
- 10.4. Language Reference
-
- 10.4.1. Literal expressions
- 10.4.2. Properties, Arrays, Lists, Maps, Indexers
- 10.4.3. Inline lists
- 10.4.4. Inline Maps
- 10.4.5. Array construction
- 10.4.6. Methods
- 10.4.7. Operators
- 10.4.8. Assignment
- 10.4.9. Types
- 10.4.10. Constructors
- 10.4.11. Variables
- 10.4.12. Functions
- 10.4.13. Bean references
- 10.4.14. Ternary Operator (If-Then-Else)
- 10.4.15. The Elvis Operator
- 10.4.16. Safe Navigation operator
- 10.4.17. Collection Selection
- 10.4.18. Collection Projection
- 10.4.19. Expression templating
- 10.5. Classes used in the examples
- 11. Aspect Oriented Programming with Spring
-
- 11.1. Introduction
- 11.2. @AspectJ support
- 11.3. Schema-based AOP support
- 11.4. Choosing which AOP declaration style to use
- 11.5. Mixing aspect types
- 11.6. Proxying mechanisms
- 11.7. Programmatic creation of @AspectJ Proxies
- 11.8. Using AspectJ with Spring applications
- 11.9. Further Resources
- 12. Spring AOP APIs
-
- 12.1. Introduction
- 12.2. Pointcut API in Spring
- 12.3. Advice API in Spring
- 12.4. Advisor API in Spring
- 12.5. Using the ProxyFactoryBean to create AOP proxies
- 12.6. Concise proxy definitions
- 12.7. Creating AOP proxies programmatically with the ProxyFactory
- 12.8. Manipulating advised objects
- 12.9. Using the "auto-proxy" facility
- 12.10. Using TargetSources
- 12.11. Defining new Advice types
- 12.12. Further resources
- IV. Testing
-
- 13. Introduction to Spring Testing
- 14. Unit Testing
- 15. Integration Testing
-
- 15.1. Overview
- 15.2. Goals of Integration Testing
- 15.3. JDBC Testing Support
- 15.4. Annotations
- 15.5. Spring TestContext Framework
-
- 15.5.1. Key abstractions
- 15.5.2. Bootstrapping the TestContext framework
- 15.5.3. TestExecutionListener configuration
- 15.5.4. Context management
-
- Context configuration with XML resources
- Context configuration with Groovy scripts
- Context configuration with annotated classes
- Mixing XML, Groovy scripts, and annotated classes
- Context configuration with context initializers
- Context configuration inheritance
- Context configuration with environment profiles
- Context configuration with test property sources
- Loading a WebApplicationContext
- Context caching
- Context hierarchies
- 15.5.5. Dependency injection of test fixtures
- 15.5.6. Testing request and session scoped beans
- 15.5.7. Transaction management
- 15.5.8. Executing SQL scripts
- 15.5.9. TestContext Framework support classes
- 15.6. Spring MVC Test Framework
- 15.7. PetClinic Example
- 16. Further Resources
- V. Data Access
-
- 17. Transaction Management
-
- 17.1. Introduction to Spring Framework transaction management
- 17.2. Advantages of the Spring Framework’s transaction support model
- 17.3. Understanding the Spring Framework transaction abstraction
- 17.4. Synchronizing resources with transactions
- 17.5. Declarative transaction management
-
- 17.5.1. Understanding the Spring Framework’s declarative transaction implementation
- 17.5.2. Example of declarative transaction implementation
- 17.5.3. Rolling back a declarative transaction
- 17.5.4. Configuring different transactional semantics for different beans
- 17.5.5. <tx:advice/> settings
- 17.5.6. Using @Transactional
- 17.5.7. Transaction propagation
- 17.5.8. Advising transactional operations
- 17.5.9. Using @Transactional with AspectJ
- 17.6. Programmatic transaction management
- 17.7. Choosing between programmatic and declarative transaction management
- 17.8. Transaction bound event
- 17.9. Application server-specific integration
- 17.10. Solutions to common problems
- 17.11. Further resources
- 18. DAO support
- 19. Data access with JDBC
-
- 19.1. Introduction to Spring Framework JDBC
- 19.2. Using the JDBC core classes to control basic JDBC processing and error handling
- 19.3. Controlling database connections
- 19.4. JDBC batch operations
- 19.5. Simplifying JDBC operations with the SimpleJdbc classes
-
- 19.5.1. Inserting data using SimpleJdbcInsert
- 19.5.2. Retrieving auto-generated keys using SimpleJdbcInsert
- 19.5.3. Specifying columns for a SimpleJdbcInsert
- 19.5.4. Using SqlParameterSource to provide parameter values
- 19.5.5. Calling a stored procedure with SimpleJdbcCall
- 19.5.6. Explicitly declaring parameters to use for a SimpleJdbcCall
- 19.5.7. How to define SqlParameters
- 19.5.8. Calling a stored function using SimpleJdbcCall
- 19.5.9. Returning ResultSet/REF Cursor from a SimpleJdbcCall
- 19.6. Modeling JDBC operations as Java objects
- 19.7. Common problems with parameter and data value handling
- 19.8. Embedded database support
-
- 19.8.1. Why use an embedded database?
- 19.8.2. Creating an embedded database using Spring XML
- 19.8.3. Creating an embedded database programmatically
- 19.8.4. Selecting the embedded database type
- 19.8.5. Testing data access logic with an embedded database
- 19.8.6. Generating unique names for embedded databases
- 19.8.7. Extending the embedded database support
- 19.9. Initializing a DataSource
- 20. Object Relational Mapping (ORM) Data Access
-
- 20.1. Introduction to ORM with Spring
- 20.2. General ORM integration considerations
- 20.3. Hibernate
-
- 20.3.1. SessionFactory setup in a Spring container
- 20.3.2. Implementing DAOs based on plain Hibernate API
- 20.3.3. Declarative transaction demarcation
- 20.3.4. Programmatic transaction demarcation
- 20.3.5. Transaction management strategies
- 20.3.6. Comparing container-managed and locally defined resources
- 20.3.7. Spurious application server warnings with Hibernate
- 20.4. JDO
- 20.5. JPA
- 21. Marshalling XML using O/X Mappers
- VI. The Web
-
- 22. Web MVC framework
-
- 22.1. Introduction to Spring Web MVC framework
- 22.2. The DispatcherServlet
- 22.3. Implementing Controllers
-
- 22.3.1. Defining a controller with @Controller
- 22.3.2. Mapping Requests With @RequestMapping
-
- Composed @RequestMapping Variants
- @Controller and AOP Proxying
- New Support Classes for @RequestMapping methods in Spring MVC 3.1
- URI Template Patterns
- URI Template Patterns with Regular Expressions
- Path Patterns
- Path Pattern Comparison
- Path Patterns with Placeholders
- Suffix Pattern Matching
- Suffix Pattern Matching and RFD
- Matrix Variables
- Consumable Media Types
- Producible Media Types
- Request Parameters and Header Values
- HTTP HEAD and HTTP OPTIONS
- 22.3.3. Defining @RequestMapping handler methods
-
- Supported method argument types
- Supported method return types
- Binding request parameters to method parameters with @RequestParam
- Mapping the request body with the @RequestBody annotation
- Mapping the response body with the @ResponseBody annotation
- Creating REST Controllers with the @RestController annotation
- Using HttpEntity
- Using @ModelAttribute on a method
- Using @ModelAttribute on a method argument
- Using @SessionAttributes to store model attributes in the HTTP session between requests
- Using @SessionAttribute to access pre-existing global session attributes
- Using @RequestAttribute to access request attributes
- Working with "application/x-www-form-urlencoded" data
- Mapping cookie values with the @CookieValue annotation
- Mapping request header attributes with the @RequestHeader annotation
- Method Parameters And Type Conversion
- Customizing WebDataBinder initialization
- Advising controllers with @ControllerAdvice and @RestControllerAdvice
- Jackson Serialization View Support
- Jackson JSONP Support
- 22.3.4. Asynchronous Request Processing
- 22.3.5. Testing Controllers
- 22.4. Handler mappings
- 22.5. Resolving views
- 22.6. Using flash attributes
- 22.7. Building URIs
- 22.8. Using locales
- 22.9. Using themes
- 22.10. Spring’s multipart (file upload) support
- 22.11. Handling exceptions
- 22.12. Web Security
- 22.13. Convention over configuration support
- 22.14. HTTP caching support
- 22.15. Code-based Servlet container initialization
- 22.16. Configuring Spring MVC
-
- 22.16.1. Enabling the MVC Java Config or the MVC XML Namespace
- 22.16.2. Customizing the Provided Configuration
- 22.16.3. Conversion and Formatting
- 22.16.4. Validation
- 22.16.5. Interceptors
- 22.16.6. Content Negotiation
- 22.16.7. View Controllers
- 22.16.8. View Resolvers
- 22.16.9. Serving of Resources
- 22.16.10. Default Servlet
- 22.16.11. Path Matching
- 22.16.12. Message Converters
- 22.16.13. Advanced Customizations with MVC Java Config
- 22.16.14. Advanced Customizations with the MVC Namespace
- 23. View Technologies
-
- 23.1. Introduction
- 23.2. Thymeleaf
- 23.3. Groovy Markup
- 23.4. Velocity & FreeMarker
- 23.5. JSP & JSTL
- 23.6. Script views
- 23.7. XML Marshalling
- 23.8. Tiles
- 23.9. XSLT
- 23.10. Document views: PDF, Excel
- 23.11. JasperReports
- 23.12. Feed views: RSS, Atom
- 23.13. JSON Mapping View
- 23.14. XML Mapping View
- 24. Integrating with other web frameworks
- 25. Portlet MVC Framework
-
- 25.1. Introduction
- 25.2. The DispatcherPortlet
- 25.3. The ViewRendererServlet
- 25.4. Controllers
- 25.5. Handler mappings
- 25.6. Views and resolving them
- 25.7. Multipart (file upload) support
- 25.8. Handling exceptions
- 25.9. Annotation-based controller configuration
-
- 25.9.1. Setting up the dispatcher for annotation support
- 25.9.2. Defining a controller with @Controller
- 25.9.3. Mapping requests with @RequestMapping
- 25.9.4. Supported handler method arguments
- 25.9.5. Binding request parameters to method parameters with @RequestParam
- 25.9.6. Providing a link to data from the model with @ModelAttribute
- 25.9.7. Specifying attributes to store in a Session with @SessionAttributes
- 25.9.8. Customizing WebDataBinder initialization
- 25.10. Portlet application deployment
- 26. WebSocket Support
-
- 26.1. Introduction
- 26.2. WebSocket API
- 26.3. SockJS Fallback
- 26.4. STOMP
-
- 26.4.1. Overview
- 26.4.2. Benefits
- 26.4.3. Enable STOMP
- 26.4.4. Flow of Messages
- 26.4.5. Annotated Controllers
- 26.4.6. Send Messages
- 26.4.7. Simple Broker
- 26.4.8. External Broker
- 26.4.9. Connect to Broker
- 26.4.10. Dot as Separator
- 26.4.11. Authentication
- 26.4.12. Token Authentication
- 26.4.13. User Destinations
- 26.4.14. Events and Interception
- 26.4.15. STOMP Client
- 26.4.16. WebSocket Scope
- 26.4.17. Performance
- 26.4.18. Monitoring
- 26.4.19. Testing
- 27. CORS Support
- VII. Integration
-
- 28. Remoting and web services using Spring
-
- 28.1. Introduction
- 28.2. Exposing services using RMI
- 28.3. Using Hessian or Burlap to remotely call services via HTTP
- 28.4. Exposing services using HTTP invokers
- 28.5. Web services
- 28.6. JMS
- 28.7. AMQP
- 28.8. Auto-detection is not implemented for remote interfaces
- 28.9. Considerations when choosing a technology
- 28.10. Accessing RESTful services on the client
- 29. Enterprise JavaBeans (EJB) integration
- 30. JMS (Java Message Service)
- 31. JMX
- 32. JCA CCI
- 33. Email
- 34. Task Execution and Scheduling
- 35. Dynamic language support
- 36. Cache Abstraction