The Spring.NET Framework

Reference Documentation

Authors

Mark Pollack, Rick Evans, Aleksandar Seovic, Federico Spinazzi, Rob Harrop, Griffin Caprio, Choy Rim, The Spring Java Team

Version 1.1 Preview Release 3

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.

Last Updated December 6, 2006


1. Preface
2. Introduction
2.1. Overview
2.2. Background
2.3. Modules
2.4. License Information
2.5. Support
3. Background information
3.1. Inversion of Control
I. Core Technologies
4. Objects, Object Factories, and Application Contexts
4.1. Introduction
4.2. Introduction to the IObjectFactory, IApplicationContext, and IObjectDefinition
4.2.1. The IObjectFactory and IApplicationContext
4.2.2. The IObjectDefinition
4.2.3. Object Creation
4.2.3.1. Object creation via constructor invocation
4.2.3.2. Object creation via a static factory method
4.2.3.3. Object creation via an instance factory method
4.2.4. Object creation of generic types
4.2.4.1. Object creation of generic types via constructor invocation
4.2.4.2. Object creation of generic types via static factory method
4.2.4.3. Object creation of generic types via instance factory method
4.2.5. The object identifiers (id and name)
4.2.6. Singleton & Prototype Scope
4.3. Properties, collaborators, autowiring and dependency checking
4.3.1. Setting object properties and collaborators
4.3.2. Constructor Argument Resolution
4.3.2.1. Constructor Argument Type Matching
4.3.2.2. Constructor Argument Index
4.3.2.3. Constructor Arguments by Name
4.3.3. Object properties and constructor arguments in detail
4.3.3.1. Setting null values
4.3.3.2. Setting collection values
4.3.3.3. Setting generic collection values
4.3.3.4. Setting indexer properties
4.3.3.5. Inline objects
4.3.3.6. The idref element
4.3.3.7. Referring to collaborating objects
4.3.3.8. Value and ref shortcut forms
4.3.3.9. Compound property names
4.3.4. Method Injection
4.3.4.1. Lookup Method Injection
4.3.4.2. Arbitrary method replacement
4.3.5. Setting a reference using the members of other objects and classes.
4.3.5.1. Setting a reference to the value of property.
4.3.5.2. Setting a reference to the value of field.
4.3.5.3. Setting a property or constructor argument to the return value of a method invocation.
4.3.6. Additional IFactoryObject implementations
4.3.6.1. Log4Net
4.3.7. Using depends-on
4.3.8. Autowiring collaborators
4.3.9. Checking for dependencies
4.4. Type conversion
4.4.1. Type Conversion for Enumerations
4.4.2. Built-in TypeConverters
4.4.3. Custom Type Conversion
4.4.3.1. Using CustomConverterConfigurer
4.5. Customizing the nature of an object
4.5.1. Lifecycle interfaces
4.5.1.1. IInitializingObject / init-method
4.5.1.2. IDisposable / destroy-method
4.5.2. Knowing who you are
4.5.2.1. IObjectFactoryAware
4.5.2.2. IObjectNameAware
4.5.3. IFactoryObject
4.6. Abstract and Child object definitions
4.7. Interacting with the IObjectFactory
4.7.1. Obtaining an IFactoryObject, not its product
4.8. Customizing objects with IObjectPostProcessors
4.9. Customizing object factories with ObjectFactoryPostProcessors
4.9.1. The PropertyPlaceholderConfigurer
4.9.1.1. Replacement with Environment Variables
4.9.2. The PropertyOverrideConfigurer
4.10. Using the alias element to add aliases for existing objects
4.11. Introduction to the IApplicationContext
4.12. Configuration of IApplicationContext
4.12.1. Registering custom parsers
4.12.2. Creating custom resource handlers
4.12.3. Configuring Type Aliases
4.12.4. Registering Type Converters
4.13. Added functionality of the IApplicationContext
4.13.1. Context Hierarchies
4.13.2. Using the IMessageSource
4.13.3. Using resources within Spring.NET
4.13.4. Loosely coupled events
4.13.5. Event notification from IApplicationContext
4.14. Customized behavior in the ApplicationContext
4.14.1. ApplicationContextAware marker interface
4.14.2. The IObjectPostProcessor
4.14.3. The IObjectFactoryPostProcessor
4.14.4. The PropertyPlaceholderConfigurer
4.15. Importing Object Definitions from One File Into Another
4.16. Service Locator access
5. The IObjectWrapper and Type conversion
5.1. Introduction
5.2. Manipulating objects using the IObjectWrapper
5.2.1. Setting and getting basic and nested properties
5.2.2. Other features worth mentioning
5.3. Type conversion
5.3.1. Type Conversion for Enumerations
5.4. Built-in TypeConverters
6. The IResource abstraction
6.1. Introduction
6.2. The IResource interface
6.3. Built-in IResource implementations
6.4. The IResourceLoader
6.5. The IResourceLoaderAware interface
6.6. Application contexts and IResource paths
7. Threading and Concurrency Support
7.1. Introduction
7.2. Thread Local Storage
7.3. Synchronization Primitives
7.3.1. ISync
7.3.2. SyncHolder
7.3.3. Latch
7.3.4. Semaphore
8. Object Pooling
8.1. Introduction
8.2. Interfaces and Implementations
9. Spring.NET miscellanea
9.1. Introduction
9.2. PathMatcher
9.2.1. General rules
9.2.2. Matching filenames
9.2.3. Matching subdirectories
9.2.4. Case does matter, slashes don't
10. Expression Evaluation
10.1. Introduction
10.2. Evaluating Expressions
10.3. Language Reference
10.3.1. Literal expressions
10.3.2. Properties, Arrays, Lists, Dictionaries, Indexers
10.3.2.1. Defining Arrays, Lists and Dictionaries Inline
10.3.3. Methods
10.3.4. Operators
10.3.4.1. Relational operators
10.3.4.2. Logical operators
10.3.4.3. Mathmatical operators
10.3.5. Assignment
10.3.6. Expression lists
10.3.7. Types
10.3.8. Type Registration
10.3.9. Constructors
10.3.10. Variables
10.3.10.1. The '#this' and '#root' variables
10.3.11. Ternary Operator (If-Then-Else)
10.3.12. List Projection and Selection
10.3.13. Collection Processors and Aggregators
10.3.13.1. Count Aggregator
10.3.13.2. Sum Aggregator
10.3.13.3. Average Aggregator
10.3.13.4. Minimum Aggregator
10.3.13.5. Maximum Aggregator
10.3.13.6. Non-null Processor
10.3.13.7. Distinct Processor
10.3.13.8. Sort Processor
10.3.14. Spring Object References
10.3.15. Lambda Expressions
10.3.16. Null Context
10.4. Classes used in the examples
11. Validation Framework
11.1. Introduction
11.2. Example Usage
11.3. Validator Groups
11.4. Validators
11.4.1. Condition Validator
11.4.2. Required Validator
11.4.3. Regular Expression Validator
11.4.4. Generic Validator
11.4.5. Conditional Validator Execution
11.5. Validator Actions
11.5.1. Error Message Action
11.5.2. Generic Actions
11.6. Validator References
11.7. Usage tips within ASP.NET
11.7.1. Rendering Validation Errors
11.7.1.1. Configuring which Error Renderer to use.
12. Aspect Oriented Programming with Spring.NET
12.1. Introduction
12.1.1. AOP concepts
12.1.2. Spring.NET AOP capabilities
12.1.3. AOP Proxies in Spring.NET
12.2. Pointcuts in Spring.NET
12.2.1. Concepts
12.2.2. Operations on pointcuts
12.2.3. Convenience pointcut implementations
12.2.3.1. Static pointcuts
12.2.3.2. Dynamic Pointcuts
12.2.4. Custom pointcuts
12.3. Advice types in Spring.NET
12.3.1. Advice Lifecycle
12.3.2. Advice types
12.3.2.1. Interception Around Advice
12.3.2.2. Before advice
12.3.2.3. Throws advice
12.3.2.4. After Returning advice
12.3.2.5. Introduction advice
12.4. Advisors in Spring.NET
12.5. Using the ProxyFactoryObject to create AOP proxies
12.5.1. Basics
12.5.2. ProxyFactoryObject Properties
12.5.3. Proxying Interfaces
12.5.4. Proxying Classes
12.6. Creating AOP Proxies Programmatically with the ProxyFactory
12.7. Manipulating Advised Objects
12.8. Using the "autoproxy" facility
12.8.1. Autoproxy object definitions
12.8.1.1. ObjectNameAutoProxyCreator
12.8.1.2. DefaultAdvisorAutoProxyCreator
12.8.1.3. AbstractAutoProxyCreator
12.8.2. Using attribute-driven auto-proxying
12.9. Using TargetSources
12.9.1. Hot swappable target sources
12.9.2. Pooling target sources
12.9.3. Prototype target sources
12.10. Defining new Advice types
12.11. Further reading and resources
13. Common Logging
13.1. Introduction
13.1.1. Logging API
13.2. Implementations and Configuration
13.2.1. Console Logger
13.3. Log4Net
II. Middle Tier Data Access
14. Transaction management
14.1. Introduction
14.2. Motivations
14.3. Key Abstractions
14.4. Resource synchronization with transactions
14.4.1. High-level approach
14.4.2. Low-level approach
14.5. Declarative transaction management
14.5.1. Understanding Spring's declarative transaction implementation
14.5.2. A First Example
14.5.3. Transaction Attributes settings
14.5.4. Declarative Transactions using AutoProxyCreator
14.5.5. Declarative Transactions using TransactionProxyFactoryObject
14.5.6. Declarative Transactions using ProxyFactoryObject
14.6. Programmatic transaction management
14.6.1. Using the TransactionTemplate
14.6.2. Using the PlatformTransactionManager
14.7. Choosing between programmatic and declarative transaction management
15. DAO support
15.1. Introduction
15.2. Consistent exception hierarchy
15.3. Consistent abstract classes for DAO support
16. DbProvider
16.1. Introduction
16.2. IDbProvider and DbProviderFactory
16.3. XML based configuration
16.4. Connection String management
17. Data access using ADO.NET
17.1. Introduction
17.2. Motivations
17.3. Provider Abstraction
17.3.1. Creating an instance of IDbProvider
17.4. Namespaces
17.5. Approaches to Data Access
17.6. Introduction to AdoTemplate
17.6.1. Execute Callback
17.6.2. Execute Callback .NET 2.0
17.6.3. .NET 1.1
17.6.4. Quick Guide to AdoTemplate Methods
17.7. Exception Translation
17.8. Parameter Managment
17.8.1. IDbParametersBuilder
17.8.2. IDbParameters
17.9. Mapping DBNull values
17.10. Basic data access operations
17.10.1. ExecuteNonQuery
17.10.2. ExecuteScalar
17.11. Queries and Lightweight Object Mapping
17.11.1. ResultSetExtractor
17.11.2. RowCallback
17.11.3. RowMapper
17.11.4. Query for a single object
17.11.5. Query using a CommandCreator
17.12. DataTable and DataSet
17.12.1. DataTables
17.12.2. DataSets
17.13. Deriving Stored Procedure Parameters
17.14. Database operations as Objects
17.14.1. AdoNonQuery
17.14.2. AdoQuery
17.14.3. MappingAdoQuery
17.14.4. Stored Procedure
17.14.5. DataSetOperation
18. ORM Integration
18.1. Introduction
III. The Web
19. Spring.NET Web Framework
19.1. Introduction
19.2. Automatic context loading and hierarchical contexts
19.2.1. Configuration
19.2.2. Context Hierarchy
19.3. Dependency Injection for ASP.NET Pages
19.3.1. Injecting Dependencies into Controls
19.4. Master Pages in ASP.NET 1.1
19.4.1. Linking child pages to their master
19.5. Bidirectional Data Binding and Model Management
19.5.1. Data Binding Under the Hood
19.5.1.1. Binding Direction
19.5.1.2. Formatters
19.5.1.3. Type Conversion
19.5.1.4. Data Binding Events
19.6. Localization
19.6.1. Automatic Localization Using Localizers ("Push" Localization)
19.6.2. Working with Localizers
19.6.3. Applying Resources Manually ("Pull" Localization)
19.6.4. Localizing Images within a Web Application
19.6.5. Global Resources
19.6.6. User Culture Management
19.6.6.1. DefaultWebCultureResolver
19.6.6.2. RequestCultureResolver
19.6.6.3. SessionCultureResolver
19.6.6.4. CookieCultureResolver
19.6.7. Changing Cultures
19.7. Result Mapping
19.8. Client-Side Scripting
19.8.1. Registering Scripts within the head HTML section
19.8.2. Adding CSS Definitions to the head Section
19.8.3. Well-Known Directories
IV. Services
20. .NET Remoting
20.1. Introduction
20.2. Publishing SAOs on the Server
20.2.1. SAO Singleton
20.2.2. SAO SingleCall
20.2.3. IIS Application Configuration
20.3. Accessing a SAO on the Client
20.4. CAO best practices
20.5. Registering a CAO object on the Server
20.5.1. Applying AOP advice to exported CAO objects
20.6. Accessing a CAO on the Client
20.6.1. Applying AOP advice to client side CAO objects.
20.7. XML Schema for configuration
20.8. Additional Resources
21. .NET Enterprise Services
21.1. Introduction
21.2. Serviced Components
21.3. Server Side
21.4. Client Side
22. Web Services
22.1. Server-side
22.1.1. Removing the need for .asmx files
22.1.2. Injecting dependencies into web services
22.1.3. Exposing PONOs as Web Services
22.1.4. Exporting an AOP Proxy as a Web Service
22.1.5. Client-side issues
22.2. Client-side
22.2.1. The WebServiceProxyFactory
22.2.2. The WebServiceClientFactory
23. Windows Services
23.1. Remarks
23.2. Introduction
23.3. The Spring.Services.WindowsService.Process.exe application
23.3.1. Installing
23.3.2. Configuration
23.4. Running an application context as a windows service
23.4.1. service.config
23.4.1.1. Let the application know where it is
23.4.2. watcher.xml - optional
23.4.3. bin directory - optional
23.5. Customizing or extending
23.5.1. The .config file
V. VS.NET Integration
24. Visual Studio.NET Integration
24.1. XML Editing and Validation
24.2. Versions of XML Schema
24.3. Integrated API help
VI. Quickstart applications
25. IoC Quickstarts
25.1. Introduction
25.2. Movie Finder
25.2.1. Getting Started - Movie Finder
25.2.2. First Object Definition
25.2.3. Setter Injection
25.2.4. Constructor Injection
25.2.5. Summary
25.2.6. Logging
25.3. ApplicationContext and IMessageSource
25.3.1. Introduction
25.4. ApplicationContext and IEventRegistry
25.4.1. Introduction
25.5. Pooling example
25.5.1. Implementing Spring.Pool.IPoolableObjectFactory
25.5.2. Being smart using pooled objects
25.5.3. Using the executor to do a parallel grep
25.6. AOP
26. AOP Guide
26.1. Introduction
26.2. The basics
26.2.1. Applying advice
26.2.2. Using Pointcuts - the basics
26.3. Going deeper
26.3.1. Other types of Advice
26.3.1.1. Before advice
26.3.1.2. After advice
26.3.1.3. Throws advice
26.3.1.4. Introductions (mixins)
26.3.1.5. Layering advice
26.3.1.6. Configuring advice
26.3.2. Using Attributes to define Pointcuts
26.4. The Spring.NET AOP Cookbook
26.4.1. Caching
26.4.2. Performance Monitoring
26.4.3. Retry Rules
26.5. Spring.NET AOP Best Practices
27. .NET Remoting Quick start
27.1. Introduction
27.2. The Remoting Sample Project
27.3. Implementation
27.4. Running the application
27.5. Remoting Schema
27.6. Additional Resources
28. Web Quickstarts
28.1. Introduction
29. SpringAir - Reference Application
29.1. Introduction
29.2. The Architecture
29.3. The Implementation
29.3.1. The Domain Layer
29.3.2. The Service Layer
29.3.3. The Web Layer
29.4. Summary
30. Data Access QuickStart
30.1. Introduction
31. Transactions QuickStart
31.1. Introduction
31.2. Application Overview
31.2.1. Interfaces
VII. Spring.NET for Java developers
32. Spring.NET for Java Developers
32.1. Introduction
32.2. Beans to Objects
32.3. PropertyEditors to TypeConverters
32.4. ResourceBundle-ResourceManager
32.5. Exceptions
32.6. Application Configuration
32.7. AOP Framework
32.7.1. Cannot specify target name at the end of interceptorNames for ProxyFactoryObject
A. Spring.NET's spring-objects.xsd