반응형
Spring Framework
Reference Documentation
3.0
Copyright © 2004-2009 Rod Johnson, Juergen Hoeller, Keith Donald, Colin Sampaleanu, Rob Harrop, Alef Arendsen, 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, Chris Beams, Tareq Abedrabbo, Andy Clement
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
- 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 getting started tutorial
- 2.4. New module organization and build system
- 2.5. Overview of new features
- 2.2. Improved documentation
-
- 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.2. Spring Expression Language
- 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.5. The Data Tier
- 2.5.7. Declarative model validation
- 2.5.8. Early support for Java EE 6
- 2.5.9. Support for embedded databases
- 2.5.8. Early support for Java EE 6
- 2.5.1. Core APIs updated for Java 5
- 2.1. Java 5
- III. Core Technologies
-
- 3. The IoC container
-
- 3.1. Introduction to the Spring IoC container and beans
- 3.2. Container overview
- 3.3. Bean overview
- 3.4. Dependencies
- 3.5. Bean scopes
- 3.6. Customizing the nature of a bean
- 3.7. Bean definition inheritance
- 3.8. Container extension points
- 3.9. Annotation-based container configuration
- 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.10.2. Automatically detecting classes and registering bean definitions
- 3.10.1. @Component and further stereotype annotations
- 3.11. Java-based container configuration
- 3.12. Registering a LoadTimeWeaver
- 3.13. Additional Capabilities of the ApplicationContext
- 3.14. The BeanFactory
- 3.1. Introduction to the Spring IoC container and beans
- 4. Resources
-
- 4.1. Introduction
- 4.2. The Resource interface
- 4.3. Built-in Resource implementations
- 4.2. The Resource interface
- 4.4. The ResourceLoader
- 4.5. The ResourceLoaderAware interface
- 4.6. Resources as dependencies
- 4.7. Application contexts and Resource paths
- 4.5. The ResourceLoaderAware interface
- 4.1. Introduction
- 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.2. Validation using Spring's Validator interface
- 5.5. Spring 3 Type Conversion
- 5.6. Spring 3 Field Formatting
- 5.7. Spring 3 Validation
- 5.1. Introduction
- 6. Spring Expression Language (SpEL)
-
- 6.1. Introduction
- 6.2. Feature Overview
- 6.3. Expression Evaluation using Spring's Expression Interface
- 6.2. Feature Overview
- 6.4. Expression support for defining bean definitions
- 6.5. Language Reference
-
- 6.5.1. Literal expressions
- 6.5.2. Properties, Arrays, Lists, Maps, Indexers
- 6.5.3. Methods
- 6.5.4. Operators
- 6.5.2. Properties, Arrays, Lists, Maps, Indexers
- 6.5.5. Assignment
- 6.5.6. Types
- 6.5.7. Constructors
- 6.5.8. Variables
- 6.5.6. Types
- 6.5.9. Functions
- 6.5.10. Ternary Operator (If-Then-Else)
- 6.5.11. The Elvis Operator
- 6.5.12. Safe Navigation operator
- 6.5.13. Collection Selection
- 6.5.14. Collection Projection
- 6.5.15. Expression templating
- 6.5.10. Ternary Operator (If-Then-Else)
- 6.5.1. Literal expressions
- 6.6. Classes used in the examples
- 6.1. Introduction
- 7. Aspect Oriented Programming with Spring
-
- 7.1. Introduction
- 7.2. @AspectJ support
- 7.3. Schema-based AOP support
- 7.4. Choosing which AOP declaration style to use
- 7.5. Mixing aspect types
- 7.6. Proxying mechanisms
- 7.7. Programmatic creation of @AspectJ Proxies
- 7.8. Using AspectJ with Spring applications
- 7.9. Further Resources
- 8. Spring AOP APIs
-
- 8.1. Introduction
- 8.2. Pointcut API in Spring
- 8.3. Advice API in Spring
- 8.4. Advisor API in Spring
- 8.5. Using the ProxyFactoryBean to create AOP proxies
- 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.7. Creating AOP proxies programmatically with the ProxyFactory
- 8.10. Using TargetSources
- 8.11. Defining new Advice types
- 8.12. Further resources
- 8.1. Introduction
- 9. Testing
- 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.3. Understanding the Spring Framework transaction abstraction
- 10.4. Synchronizing resources with transactions
- 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.2. Example of declarative transaction implementation
- 10.5.7. Transaction propagation
- 10.5.8. Advising transactional operations
- 10.5.9. Using @Transactional with AspectJ
- 10.5.1. Understanding the Spring Framework's declarative transaction implementation
- 10.6. Programmatic transaction management
- 10.7. Choosing between programmatic and declarative transaction management
- 10.8. Application server-specific integration
- 10.9. Solutions to common problems
- 10.10. Further Resources
- 10.1. Introduction to Spring Framework transaction management
- 11. DAO support
- 12. Data access with JDBC
-
- 12.1. Introduction to Spring Framework JDBC
- 12.2. Using the JDBC core classes to control basic JDBC processing and error handling
- 12.3. Controlling database connections
- 12.4. JDBC batch operations
- 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.5.2. Retrieving auto-generated keys using SimpleJdbcInsert
- 12.5.1. Inserting data using SimpleJdbcInsert
- 12.6. Modeling JDBC operations as Java objects
- 12.7. Common problems with parameter and data value handling
- 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.8.2. Creating an embedded database instance using Spring XML
- 12.8.1. Why use an embedded database?
- 12.9. Initializing a DataSource
- 13. Object Relational Mapping (ORM) Data Access
-
- 13.1. Introduction to ORM with Spring
- 13.2. General ORM integration considerations
- 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.3.2. Implementing DAOs based on plain Hibernate 3 API
- 13.3.1. SessionFactory setup in a Spring container
- 13.4. JDO
- 13.5. JPA
- 13.6. iBATIS SQL Maps
- 13.1. Introduction to ORM with Spring
- 14. Marshalling XML using O/X Mappers
- V. The Web
-
- 15. Web MVC framework
-
- 15.1. Introduction to Spring Web MVC framework
- 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. Providing a link to data from the model with @ModelAttribute
- 15.3.2.8. Specifying attributes to store in a session with @SessionAttributes
- 15.3.2.9. Mapping cookie values with the @CookieValue annotation
- 15.3.2.10. Mapping request header attributes with the @RequestHeader annotation
- 15.3.2.11. Customizing WebDataBinder initialization
- 15.3.2.2. Advanced @RequestMapping options
- 15.3.2.1. URI Templates
- 15.3.1. Defining a controller with @Controller
- 15.4. Handler mappings
- 15.5. Resolving views
- 15.6. Using locales
- 15.7. Using themes
- 15.8. Spring's multipart (fileupload) support
- 15.9. Handling exceptions
- 15.10. Convention over configuration support
- 15.11. ETag support
- 15.12. 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.2. 'Plain-old' JSPs versus JSTL
-
- 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.2.4.2. The form tag
- 16.2.4.1. Configuration
- 16.2.1. View resolvers
- 16.3. Tiles
- 16.4. Velocity & FreeMarker
- 16.5. XSLT
- 16.6. Document views (PDF/Excel)
- 16.7. JasperReports
- 16.8. Feed Views
- 16.9. XML Marshalling View
- 16.10. JSON Mapping View
- 16.9. XML Marshalling View
- 16.1. Introduction
- 17. Integrating with other web frameworks
- 18. Portlet MVC Framework
-
- 18.1. Introduction
- 18.2. The DispatcherPortlet
- 18.3. The ViewRendererServlet
- 18.4. Controllers
- 18.3. The ViewRendererServlet
- 18.5. Handler mappings
- 18.6. Views and resolving them
- 18.7. Multipart (file upload) support
- 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.2. Defining a controller with @Controller
- 18.9.1. Setting up the dispatcher for annotation support
- 18.10. Portlet application deployment
- VI. Integration
-
- 19. Remoting and web services using Spring
-
- 19.1. Introduction
- 19.2. Exposing services using RMI
- 19.3. Using Hessian or Burlap to remotely call services via HTTP
- 19.4. Exposing services using HTTP invokers
- 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.5.9. Exposing web services using XFire
- 19.5.2. Accessing web services using JAX-RPC
- 19.5.1. Exposing servlet-based web services using JAX-RPC
- 19.6. JMS
- 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.8. Considerations when choosing a technology
- 19.1. Introduction
- 20. Enterprise JavaBeans (EJB) integration
- 21. JMS (Java Message Service)
- 22. JMX
-
- 22.1. Introduction
- 22.2. Exporting your beans to JMX
- 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.3.2. Using Source-Level Metadata (JDK 5.0 annotations)
- 22.3.1. The MBeanInfoAssembler Interface
- 22.4. Controlling the ObjectNames for your beans
- 22.5. JSR-160 Connectors
- 22.6. Accessing MBeans via Proxies
- 22.7. Notifications
- 22.8. Further Resources
- 22.1. Introduction
- 23. JCA CCI
- 24. Email
- 25. Task Execution and Scheduling
- 26. Dynamic language support
- 27. Annotations and Source Level Metadata Support
- VII. Appendices
-
- A. Classic Spring Usage
- B. Classic Spring AOP Usage
-
- B.1. Pointcut API in Spring
- B.2. Advice API in Spring
- B.3. Advisor API in Spring
- B.4. Using the ProxyFactoryBean to create AOP proxies
- 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.6. Creating AOP proxies programmatically with the ProxyFactory
- B.9. Using TargetSources
- 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.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.3.2. <jee:jndi-lookup/> (with single JNDI environment setting)
- C.2.3.1. <jee:jndi-lookup/> (simple)
- 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.5. The jms schema
- C.2.9. The tool schema
- C.2.10. The beans schema
- C.2.1. Referencing the schemas
- C.3. Setting up your IDE
- C.1. Introduction
- D. Extensible XML authoring
- E. spring-beans-2.0.dtd
- F. spring.tld
- 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
- G.2. The checkbox tag
- G.1. Introduction