From 22724a7122727e942c5ea018ed503e09ced54f29 Mon Sep 17 00:00:00 2001
From: markpollack
Date: Tue, 14 Oct 2008 05:26:44 +0000
Subject: [PATCH] update product version numbers and dates in readme.txt etc
update docs update to ActiveMQ NMS svn revision 704303 Add missing code xml
docs.
---
Spring.build | 4 +-
changelog.txt | 56 +
doc/reference/src/aop-aspect-library.xml | 280 ++--
doc/reference/src/index.xml | 4 +-
doc/reference/src/messaging.xml | 385 ++---
doc/reference/src/objects.xml | 1233 +++++++++--------
doc/reference/src/orm.xml | 409 +++---
doc/reference/src/wcf.xml | 176 +--
doc/reference/src/web.xml | 472 ++++---
doc/reference/src/webservices.xml | 72 +-
readme.txt | 2 +-
src/Spring/CommonAssemblyInfo.cs | 2 +-
src/Spring/Spring.Aop/Spring.Aop.2005.csproj | 1 +
.../Spring.Core/Spring.Core.2005.csproj | 1 +
.../Nms/Connections/CachedSession.cs | 10 +
.../Connections/SingleConnectionFactory.cs | 16 +-
.../Nms/Support/Converter/ITypeMapper.cs | 16 +-
.../Nms/Support/Converter/TypeMapper.cs | 60 +-
.../Support/Converter/XmlMessageConverter.cs | 53 +-
.../Spring.Messaging.Nms.2005.csproj | 3 +
.../Spring.Messaging.2005.csproj | 1 -
21 files changed, 1865 insertions(+), 1391 deletions(-)
diff --git a/Spring.build b/Spring.build
index 710f4781..5e279850 100644
--- a/Spring.build
+++ b/Spring.build
@@ -14,10 +14,10 @@
-
+
-
+
diff --git a/changelog.txt b/changelog.txt
index c0949f50..cc221f8f 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,6 +2,61 @@ SPRING.NET FRAMEWORK CHANGELOG
==============================
http://www.springframework.net
+Release Version 1.2.0 RC1, October 15, 2008
+
+
+Bug
+[SPRNET-899] - HttpContext.CurrenHandler returns Spring's internal PageHandler instead of real Page
+[SPRNET-923] - Spring.Services generated proxies should not use explicitly ContextRegistry.GetContext or WebApplicationContext.Current direclty
+[SPRNET-967] - SaoFactoryObject should cast TransparentProxies to the interface it implements before to return
+[SPRNET-1008] - Add check for [Serializable] in SimpleMessageConverter
+[SPRNET-1017] - Apache.NMS.ActiveMQ.ConnectionClosedException when using CachingConnectionFactory
+[SPRNET-1020] - Consumer caching was not taking place for queues.
+[SPRNET-1023] - Problems performing DI with Telerik RAD controls
+[SPRNET-1027] - Spring Page Handler Factory does not respect EnableSessionState="ReadOnly", page setting cached until app pool reload
+[SPRNET-1028] - DefaultListableObjectFactory.IsAutowireCandidate(string , DependencyDescriptor) does not search parent container
+[SPRNET-1032] - elements to not append values for same key value
+[SPRNET-1047] - ObjectPostProcessors order isn't respected when mixing ]]>What this is instructing the advice to do is
+ <object name="exceptionHandlingAdvice" type="Spring.Aspects.Exceptions.ExceptionHandlerAdvice, Spring.Aop">
+ <property name="exceptionHandlers">
+ <list>
+ <value>on exception name ArithmeticException wrap System.InvalidOperationException</value>
+ </list>
+ </property>
+</object>What this is instructing the advice to do is
the following bit of code when an ArithmeticException is thrown, throw new
System.InvalidOperationException("Wrapped ArithmeticException", e), where
e is the original ArithmeticException. The default message, "Wrapped
@@ -356,19 +366,19 @@ on exception name ArithmeticException return 12
action, i.e. log(Debug,"LoggerName").Multiple exception handling statements can be specified within the
- list shown above. The processing flow is on exception, the name of
- the exception listed in the statement is compared to the thrown exception
- to see if there is a match. A comma separated list of exceptions can be
- used to group together the same action taken for different exception
- names. If the action to take is logging, then the logging action is
- performed and the search for other matching exception names continues. For
- all other actions, namely translate, wrap, replace, swallow, return, once
- an exception handler is matched, those in the chain are no longer
- evaluated. Note, do not confuse this handler chain with the general advice
- AOP advice chain. For translate, wrap, and replace actions a SpEL
- expression is created and used to instantiate a new exception (in addition
- to any other processing that may occur when evaluating the expression)
- which is then thrown.
+ list shown above. The processing flow is on exception, the name of the
+ exception listed in the statement is compared to the thrown exception to
+ see if there is a match. A comma separated list of exceptions can be used
+ to group together the same action taken for different exception names. If
+ the action to take is logging, then the logging action is performed and
+ the search for other matching exception names continues. For all other
+ actions, namely translate, wrap, replace, swallow, return, once an
+ exception handler is matched, those in the chain are no longer evaluated.
+ Note, do not confuse this handler chain with the general advice AOP advice
+ chain. For translate, wrap, and replace actions a SpEL expression is
+ created and used to instantiate a new exception (in addition to any other
+ processing that may occur when evaluating the expression) which is then
+ thrown.
The exception handling DSL also supports the ability to provide a
SpEL boolean expression to determine if the advice will apply instead of
@@ -393,23 +403,55 @@ on exception name ArithmeticException return 12
likely be better off creating your own custom aspect class instead of a
scripting approach.
- You can also configure ExceptionHandlerAdvice to use an instance of
- IExceptionHandler, for example to access more sophisticated logging
- functionality than is available with the current log action in the DSL,
- for example setting the logging level and pass the exception into the
- logging subsystem
+ You can also configure the each of the Handlers individually based
+ on the action keyword. For example, to configure the logging properties on
+ the LogExceptionHandler.
-
-
-
-
-
-
-
-
-
-
-]]>
+ <object name="logExceptionHandler" type="Spring.Aspects.Exceptions.LogExceptionHandler, Spring.Aop">
+ <property name="LogName" value="Cms.Session.ExceptionHandler" />
+ <property name="LogLevel" value="Debug"/>
+ <property name="LogMessageOnly" value="true"/>
+</object>
+
+<object name="exceptionHandlingAdvice" type="Spring.Aspects.Exceptions.ExceptionHandlerAdvice, Spring.Aop">
+ <property name="ExceptionHandlerDictionary">
+ <dictionary>
+ <entry key="log" ref="logExceptionHandler"/>
+ </dictionary>
+ </property>
+
+ <property name="ExceptionHandlers">
+ <list>
+ <value>on exception name ArithmeticException,ArgumentException log 'My Message, Method Name ' + #method.Name</value>
+ </list>
+ </property>
+</object>
+
+
+ You can also configure ExceptionHandlerAdvice to
+ use an instance of IExceptionHandler by specifing it as
+ an entry in the ExceptionHandlers list. This gives you complete control
+ over all properties of the handler but you must set
+ ConstraintExpressionText and ActionExpressionText which are normally
+ parsed for you from the string. To use the case of configuring the
+ LogExceptionHandler, this approach also lets you specify advanced logging
+ functionality, but at a cost of some additional complexity. For example
+ setting the logging level and pass the exception into the logging
+ subsystem
+
+ <object name="exceptionHandlingAdvice" type="Spring.Aspects.Exceptions.ExceptionHandlerAdvice, Spring.Aop">
+ <property name="exceptionHandlers">
+ <list>
+ <object type="Spring.Aspects.Exceptions.LogExceptionHandler">
+ <property name="LogName" value="Cms.Session.ExceptionHandler" />
+ <property name="ConstraintExpressionText" value="#e is T(System.Threading.ThreadAbortException)" />
+ <property name="ActionExpressionText" value="#log.Fatal('Request Timeout occured', #e)" />
+ </object>
+ </list>
+ </property>
+</object>
+
+ The configuration of the logger name, level, and weather or not to
pass the thrown exception as the second argument to the log method will be
@@ -455,6 +497,10 @@ on exception name ArithmeticException return 12
swallow
+
+
+ execute
+ The form of the expression depends on the action. For logging, the
@@ -476,9 +522,10 @@ on exception name ArithmeticException return 12
The logging advice lets you log the information on method entry,
exit and thrown exception (if any). The implementation is based on the
- logging library, Common.Logging, that provides
- portability across different logging libraries. There are a number of
- configuration options available, listed below
+ logging library, Common.Logging, that
+ provides portability across different logging libraries. There are a
+ number of configuration options available, listed below
@@ -510,19 +557,19 @@ on exception name ArithmeticException return 12
XML fragment. Alternatively, you can use the class
SimpleLoggingAdvice programatically.
-
-
-
-
-
+ <object name="loggingAdvice" type="Spring.Aspects.Logging.SimpleLoggingAdvice, Spring.Aop">
+ <property name="logUniqueIdentifier" value="true"/>
+ <property name="logExecutionTime" value="true"/>
+ <property name="logMethodArguments" value="true"/>
+ <property name="LogReturnValue" value="true"/>
-
-
+ <property name="Separator" value=";"/>
+ <property name="LogLevel" value="Info"/>
-
-
-]]>
+ <property name="HideProxyTypeNames" value="true"/>
+ <property name="UseDynamicLogger" value="true"/>
+</object>The default values for LogUniqueIdentifier, LogExecutionTime,
LogMethodArguments and LogReturnValue are false. The default separator
@@ -568,8 +615,8 @@ on exception name ArithmeticException return 12
use a GUID. You can alter this behavior by overriding the method
string CreateUniqueIdentifier(). The
SimpleLoggingAdvice class inherits from
- AbstractLoggingAdvice, which has the abstract
- method object InvokeUnderLog(IMethodInvocation invocation, ILog
+ AbstractLoggingAdvice, which has the abstract method
+ object InvokeUnderLog(IMethodInvocation invocation, ILog
log) and you can also override the method ILog
GetLoggerForInvocation(IMethodInvocation invocation) to
customize the logger instance used for logging. Refer to the SDK
@@ -675,9 +722,9 @@ on exception (#e is T(System.ArithmeticException)) retry 3x rate (1*#n + 0.5)
RetryAdvice class programatically.
-
-
-]]>
+ <object name="exceptionHandlingAdvice" type="Spring.Aspects.RetryAdvice, Spring.Aop">
+ <property name="retryExpression" value="on exception name ArithmeticException retry 3x delay 1s"/>
+</object>Language Reference
@@ -721,13 +768,13 @@ on exception (#e is T(System.ArithmeticException)) retry 3x rate (1*#n + 0.5)To address some of the common needs for validation on the server
side, Spring provides parameter validation advice so that applies Spring's
validation rules to the method parameters. The class
- ParameterValidationAdvice is used in conjunction
- with the Validated attribute to specify which
- validation rules are applied to method parameters. For example, to apply
- parameter validation to the method SuggestFlights in the BookingAgent
- class used in the SpringAir sample
- application, you would apply the Validated
- attribute to the method parameters as shown below.
+ ParameterValidationAdvice is used in conjunction with
+ the Validated attribute to specify which validation
+ rules are applied to method parameters. For example, to apply parameter
+ validation to the method SuggestFlights in the BookingAgent class used in
+ the SpringAir sample application, you
+ would apply the Validated attribute to the method
+ parameters as shown below.
public FlightSuggestions SuggestFlights( [Validated("tripValidator")] Trip trip)
{
@@ -736,30 +783,29 @@ on exception (#e is T(System.ArithmeticException)) retry 3x rate (1*#n + 0.5)The Validated attribute takes a string name that
specifies the name of the validation rule, i.e. the name of the IValidator
- object in the Spring application context. The
- Validated attribute is located in the namespace
- Spring.Validation of the Spring.Core
- assembly.
+ object in the Spring application context. The Validated
+ attribute is located in the namespace Spring.Validation
+ of the Spring.Core assembly.
The configuration of the advice is to simply define the an instance
of the ParameterValidationAdvice class and apply the
advice, for example based on object names using an
ObjectNameAutoProxyCreator, as shown below,
-
+ <object id="validationAdvice" type="Spring.Aspects.Validation.ParameterValidationAdvice, Spring.Aop"/>
-
-
-
- bookingAgent
-
-
-
-
- validationAdvice
-
-
-]]>
+<object type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator, Spring.Aop">
+ <property name="ObjectNames">
+ <list>
+ <value>bookingAgent</value>
+ </list>
+ </property>
+ <property name="InterceptorNames">
+ <list>
+ <value>validationAdvice</value>
+ </list>
+ </property>
+</object>When the advised method is invoked first the validation of each
method parameter is performed. If all validation succeeds, then the method
@@ -768,4 +814,4 @@ on exception (#e is T(System.ArithmeticException)) retry 3x rate (1*#n + 0.5)ValidationErrors.
See the SDK documentation for details.
-
\ No newline at end of file
+
diff --git a/doc/reference/src/index.xml b/doc/reference/src/index.xml
index 1312c3c1..7fdabcb7 100644
--- a/doc/reference/src/index.xml
+++ b/doc/reference/src/index.xml
@@ -60,8 +60,8 @@
The Spring.NET FrameworkReference Documentation
- Version 1.2.0 M1
- Last Updated August 15,2008
+ Version 1.2.0 RC1
+ Last Updated October 15,2008Mark
diff --git a/doc/reference/src/messaging.xml b/doc/reference/src/messaging.xml
index 23a8558b..3fd13468 100644
--- a/doc/reference/src/messaging.xml
+++ b/doc/reference/src/messaging.xml
@@ -16,8 +16,13 @@
* limitations under the License.
*/
-->
-
- Message Oriented Middleware
+
+ Message Oriented Middleware - Apache ActiveMQIntroduction
@@ -50,25 +55,27 @@
- Apache NMS in namespace Spring.Messaging.Nms.
- 'Nms' is sometimes used as the class prefix
+ Apache ActiveMQ (NMS) in namespace
+ Spring.Messaging.Nms. 'Nms' is sometimes used as
+ the class prefixTIBCO EMS in namespace Spring.Messaging.Ems.
- 'Ems' is sometimes used as the class prefix
+ 'Ems' is sometimes used as the class prefix (to becommerically
+ available )
SonicMQ in namespace Spring.Messaging.Sonic,
- 'Jms' is sometimes used as the class prefix. (available 1.2
- RC1)
+ 'Jms' is sometimes used as the class prefix. (to be commercially
+ available)
Websphere MQ in namespace
Spring.Messaging.Xms, 'Xms' is sometimes used as
- the class prefix (available 1.2 RC1)
+ the class prefix (to be commerically available)
@@ -78,11 +85,11 @@
NmsTemplate, EmsTemplate (etc.) is
used. Asynchronous message consumption is performed though a
multi-threaded message listener container,
- SimpleMessageListenerContainer. This message
- listener container is used to create Message-Driven PONOs (MDPs) which
- refer to a messaging callback class that consists of just 'plain .NET
- object's and is devoid of any specific messaging types or other artifacts.
- The IMessageConverter interface is used by both the
+ SimpleMessageListenerContainer. This message listener
+ container is used to create Message-Driven PONOs (MDPs) which refer to a
+ messaging callback class that consists of just 'plain .NET object's and is
+ devoid of any specific messaging types or other artifacts. The
+ IMessageConverter interface is used by both the
template class and the message listener container to convert between
provider message types and PONOs.
@@ -211,7 +218,12 @@
even with the option of using WCF, many people prefer to sit 'closer to
the metal' when using messaging middleware, to access specific features
and functionality not available in WCF, or simply because they are more
- comfortable with that programming model.
+ comfortable with that programming model.
+
+ A WCF binding for Apache NMS is being developed as a separate
+ project under the Spring
+ Extensions umbrella project. Stay tuned for details.
@@ -222,16 +234,16 @@
Messaging Template overviewCode that uses the messaging template classes
- (NmsTemplate, EmsTemplate,
- etc) only needs to implement callback interfaces giving them a clearly
+ (NmsTemplate, EmsTemplate, etc)
+ only needs to implement callback interfaces giving them a clearly
defined contract. The IMessageCreator callback
interface creates a message given a Session provided by the calling code
in NmsTemplate. In order to allow for more complex
usage of the provider messaging API, the callback
- ISessionCallback provides the user with the
- provider specific messaging Session and the callback
- IProducerCallback exposes a provider specific
- Session and MessageProducer pair.
+ ISessionCallback provides the user with the provider
+ specific messaging Session and the callback
+ IProducerCallback exposes a provider specific Session
+ and MessageProducer pair.
Provider messaging APIs typically expose two types of send
methods, one that takes delivery mode, priority, and time-to-live as
@@ -250,8 +262,8 @@
NmsTemplate and then safely inject this shared
reference into multiple collaborators. To be clear, the
NmsTemplate is stateful, in that it maintains a
- reference to a ConnectionFactory, but this
- state is not conversational state.
+ reference to a ConnectionFactory, but this state is
+ not conversational state.
@@ -321,11 +333,10 @@
session and also take into account the unique properties of the
producers and consumers when caching.
- MessageProducers are cached based on
- their destination. MessageConsumers are cached
- based on a key composed of the destination, selector, noLocal delivery
- flag, and the durable subscription name (if creating durable
- consumers).
+ MessageProducers are cached based on their
+ destination. MessageConsumers are cached based on a
+ key composed of the destination, selector, noLocal delivery flag, and
+ the durable subscription name (if creating durable consumers).
@@ -349,13 +360,12 @@
unique to the messaging provider. Examples of such advanced destination
management would be the creation of dynamic destinations or support for
a hierarchical namespace of destinations. The
- NmsTemplate delegates the resolution of a
- destination name to a destination object by delegating to an
- implementation of the interface
- IDestinationResolver.
+ NmsTemplate delegates the resolution of a destination
+ name to a destination object by delegating to an implementation of the
+ interface IDestinationResolver.
DynamicDestinationResolver is the default
- implementation used by NmsTemplate and
- accommodates resolving dynamic destinations.
+ implementation used by NmsTemplate and accommodates
+ resolving dynamic destinations.
Quite often the destinations used in a messaging application are
only known at runtime and therefore cannot be administratively created
@@ -412,17 +422,15 @@
possibly responding to it), and delegates boilerplate messaging
infrastructure concerns to the framework.
- A subclass of
- AbstractMessageListenerContainer is used to
- receive messages from JMS and drive the Message-Driven PONOs (MDPs) that
- are injected into it. There are one subclasses of
- AbstractMessageListenerContainer packaged with
- Spring - SimpleMessageListenerContainer.
- Additional subclasses, in particular to participate in distributed
- transactions (if the provider supports it), will be provided in future
- releases. SimpleMessageListenerContainer creates a fixed number of JMS
- sessions at startup and uses them throughout the lifespan of the
- container.
+ A subclass of AbstractMessageListenerContainer
+ is used to receive messages from JMS and drive the Message-Driven PONOs
+ (MDPs) that are injected into it. There are one subclasses of
+ AbstractMessageListenerContainer packaged with Spring
+ - SimpleMessageListenerContainer. Additional
+ subclasses, in particular to participate in distributed transactions (if
+ the provider supports it), will be provided in future releases.
+ SimpleMessageListenerContainer creates a fixed number of JMS sessions at
+ startup and uses them throughout the lifespan of the container.
@@ -471,14 +479,14 @@
the JMS Destination object is specified directly. The second case
specifies the destination using a string that is then resolved to a
messaging Destination object using the
- IDestinationResolver associated with the template.
- The last method sends the message to the destination specified by
- NmsTemplate''s
- DefaultDestination property.
+ IDestinationResolver associated with the template. The
+ last method sends the message to the destination specified by
+ NmsTemplate''s DefaultDestination
+ property.
All methods take as an argument an instance of
- IMessageCreator which defines the API contract for
- you to create the JMS message. The interface is show below
+ IMessageCreator which defines the API contract for you
+ to create the JMS message. The interface is show below
public interface IMessageCreator {
IMessage CreateMessage(ISession session);
@@ -554,23 +562,21 @@
Using MessageConvertersIn order to facilitate the sending of domain model objects, the
- NmsTemplate has various send methods that take a
- .NET object as an argument for a message's data content. The overloaded
+ NmsTemplate has various send methods that take a .NET
+ object as an argument for a message's data content. The overloaded
methods ConvertAndSend and
- ReceiveAndConvert in
- NmsTemplate delegate the conversion process to an
- instance of the IMessageConverter
- interface. This interface defines a simple contract to convert between
- .NET objects and JMS messages. The default implementation
- SimpleMessageConverter supports conversion
- between String and TextMessage, byte[] and BytesMesssage, and
- System.Collections.IDictionary and MapMessage. By using the converter,
- you and your application code can focus on the business object that is
- being sent or received via messaging and not be concerned with the
- details of how it is represented as a JMS message.
-
- The sample applications contains a XmlMessageConverter that
- converts objects to an XML string and vice-versa for sending via a
+ ReceiveAndConvert in NmsTemplate
+ delegate the conversion process to an instance of the
+ IMessageConverter interface. This interface defines a
+ simple contract to convert between .NET objects and JMS messages. The
+ default implementation SimpleMessageConverter
+ supports conversion between String and TextMessage, byte[] and
+ BytesMesssage, and System.Collections.IDictionary and MapMessage. By
+ using the converter, you and your application code can focus on the
+ business object that is being sent or received via messaging and not be
+ concerned with the details of how it is represented as a JMS message.
+ There is also an XmlMessageConverter that converts
+ objects to an XML string and vice-versa for sending via a
TextMessage.The family of ConvertAndSend messages are
@@ -619,13 +625,13 @@
template.ConvertAndSend("APP.STOCK.MARKETDATA", marketData);
}To accommodate the setting of message's properties, headers,
and body that can not be generally encapsulated inside a converter
- class, the IMessageConverterPostProcessor
- interface gives you access to the message after it has been converted
- but before it is sent. The example below demonstrates how to modify a
- message header and a property after a Hashtable is converted to a
- message using the IMessagePostProcessor. The methods
- ConvertAndSendUsingDelegate allow for the use of
- a delegate to perform message post processing. This family of methods is
+ class, the IMessageConverterPostProcessor interface
+ gives you access to the message after it has been converted but before
+ it is sent. The example below demonstrates how to modify a message
+ header and a property after a Hashtable is converted to a message using
+ the IMessagePostProcessor. The methods
+ ConvertAndSendUsingDelegate allow for the use of a
+ delegate to perform message post processing. This family of methods is
listed below
@@ -734,8 +740,8 @@ public delegate object ProducerDelegate(ISession session, IMessageProducer produ
available. This can be a dangerous operation since the calling thread
can potentially be blocked indefinitely. The property
ReceiveTimeout on
- NmsTemplate specifies how long the receiver
- should wait before giving up waiting for a message.
+ NmsTemplate specifies how long the receiver should
+ wait before giving up waiting for a message.
The Receive methods are listed
below
@@ -774,8 +780,8 @@ public delegate object ProducerDelegate(ISession session, IMessageProducer produ
The Receive method without arguments will
use the DefaultDestination. The
ReceiveSelected methods apply the provided
- message selector string to the MessageConsumer
- that is created.
+ message selector string to the MessageConsumer that
+ is created.
The ReceiveAndConvert methods apply the
template's message converter when receiving a message. The message
@@ -832,10 +838,9 @@ public delegate object ProducerDelegate(ISession session, IMessageProducer produ
Other vendors may provide a delegate based version of this
callback or even both a delegate and interface options. Apache ActiveMQ
supports only the use of delegates for message reception callbacks. As a
- programming convenience in
- Spring.Messaging.Nms.Core is an interface
- IMessageListener that can be used with
- NMS.
+ programming convenience in Spring.Messaging.Nms.Core
+ is an interface IMessageListener that can be used
+ with NMS.Below is a simple implementation of the IMessageListener interface
that processing a message.
@@ -879,11 +884,10 @@ namespace MyApp
specifies various messaging configuration parameters, such as the
ConnectionFactory, and the number of concurrent consumers to create.
There is an abstract base class for message listener containers,
- AbstractMessageListenerContainer, and one
- concrete implementation,
- SimpleMessageListenerContainer.
- SimpleMessageListenerContainer creates a fixed
- number of JMS Sessions/MessageConsumer pairs as set by the property
+ AbstractMessageListenerContainer, and one concrete
+ implementation, SimpleMessageListenerContainer.
+ SimpleMessageListenerContainer creates a fixed number
+ of JMS Sessions/MessageConsumer pairs as set by the property
ConcurrentConsumers. Here is a sample
configuration
@@ -933,13 +937,12 @@ namespace MyApp
to an implementation of IExceptionHandler and
registered with the container via the property
ExceptionListener. The registered
- IExceptionHandler will be invoked if the
- exception is of the type NMSException (or the
- equivalent root exception type for other providers). The
- SimpleMessageListenerContainer will logs the exception at error level
- and not propagate the exception to the provider. All handling of
- acknowledgement and/or transactions is done by the listener container.
- You can override the method
+ IExceptionHandler will be invoked if the exception is
+ of the type NMSException (or the equivalent root
+ exception type for other providers). The SimpleMessageListenerContainer
+ will logs the exception at error level and not propagate the exception
+ to the provider. All handling of acknowledgement and/or transactions is
+ done by the listener container. You can override the method
HandleListenerException to change this
behavior.
@@ -951,12 +954,11 @@ namespace MyApp
The ISessionAwareMessageListener interface
- The ISessionAwareMessageListener interface
- is a Spring-specific interface that provides a similar contract to the
- messaging provider's IMessageListener interface
- or Listener delegate/event, but also provides the message handling
- method with access to the Session from which the Message was
- received.
+ The ISessionAwareMessageListener interface is a
+ Spring-specific interface that provides a similar contract to the
+ messaging provider's IMessageListener interface or
+ Listener delegate/event, but also provides the message handling method
+ with access to the Session from which the Message was received.public interface ISessionAwareMessageListener
{
@@ -976,9 +978,8 @@ namespace MyApp
of course some constraints).
Consider the following interface definition. Notice that although
- the interface extends neither the
- IMessageListener nor
- ISessionAwareMessageListener interfaces, it can
+ the interface extends neither the IMessageListener
+ nor ISessionAwareMessageListener interfaces, it can
still be used as a Message-Driven PONOs (MDP) via the use of the
MessageListenerAdapter class. Notice also how the
various message handling methods are strongly typed according to the
@@ -1042,8 +1043,7 @@ namespace MyApp
}The configuration of the attendant
- MessageListenerAdapter would look like
- this
+ MessageListenerAdapter would look like this
<object id="MessagleHandler" type="MyApp.DefaultMessageHandler, MyApp"/>
@@ -1058,12 +1058,11 @@ namespace MyApp
Please note that if the above 'MessageListener' receives a Message
of a type other than ITextMessage, a
- ListenerExecutionFailedException will be thrown
- (and subsequently handled by the container by logging the
- exception).
+ ListenerExecutionFailedException will be thrown (and
+ subsequently handled by the container by logging the exception).
- If your IMessageConverter implementation
- will return multiple object types, overloading the handler method is
+ If your IMessageConverter implementation will
+ return multiple object types, overloading the handler method is
perfectly acceptable, the most specific matching method will be used. A
method with an object signature would be consider a 'catch-all' method
of last resort. For example, you can have an handler interface as shown
@@ -1173,72 +1172,83 @@ namespace MyApp
id
- A object name for the hosting listener container.
- If not specified, a object name will be automatically
- generated.
+
+ A object name for the hosting listener container. If not
+ specified, a object name will be automatically
+ generated.
+ destination (required)
- The destination name for this listener, resolved
- through the IDestinationResolver
- strategy.
+
+ The destination name for this listener, resolved through
+ the IDestinationResolver strategy.
+ ref (required)
- The object name of the handler
- object.
+
+ The object name of the handler object.
+ method
- The name of the handler method to invoke. If the
- ref points to a
- IMessageListener or Spring
- ISessionAwareMessageListener,
- this attribute may be omitted.
+
+ The name of the handler method to invoke. If the
+ ref points to a
+ IMessageListener or Spring
+ ISessionAwareMessageListener, this
+ attribute may be omitted.
+ response-destination
- The name of the default response destination to
- send response messages to. This will be applied in case of a
- request message that does not carry a "NMSReplyTo" field. The
- type of this destination will be determined by the
- listener-container's "destination-type" attribute. Note: This
- only applies to a listener method with a return value, for which
- each result object will be converted into a response
- message.
+
+ The name of the default response destination to send
+ response messages to. This will be applied in case of a
+ request message that does not carry a "NMSReplyTo" field. The
+ type of this destination will be determined by the
+ listener-container's "destination-type" attribute. Note: This
+ only applies to a listener method with a return value, for
+ which each result object will be converted into a response
+ message.
+ subscription
- The name of the durable subscription, if
- any.
+
+ The name of the durable subscription, if any.
+ selector
- An optional message selector for this
- listener.
+
+ An optional message selector for this listener.
+ pubsub-domain
- An optional boolean value. Set to true for the
- publish-subscribe domain (Topics) or false (the default) for
- point-to-point domain (Queues). This is useful when using the
- default implementation for destination resolvers.
-
+
+ An optional boolean value. Set to true for the
+ publish-subscribe domain (Topics) or false (the default) for
+ point-to-point domain (Queues). This is useful when using the
+ default implementation for destination resolvers.
+
@@ -1264,8 +1274,8 @@ namespace MyApp
The following table describes all available attributes. Consult
the class-level SDK documentation of the
AbstractMessageListenerContainer and its subclass
- SimpleMessageListenerContainer for more detail on
- the individual properties.
+ SimpleMessageListenerContainer for more detail on the
+ individual properties.
Attributes of the NMS
@@ -1288,86 +1298,97 @@ namespace MyApp
connection-factory
- A reference to the NMS
- ConnectionFactory object (the
- default object name is
- 'ConnectionFactory').
+
+ A reference to the NMS
+ ConnectionFactory object (the default
+ object name is 'ConnectionFactory').
+ destination-resolver
- A reference to the
- IDestinationResolver strategy for
- resolving JMS
- Destinations.
+
+ A reference to the
+ IDestinationResolver strategy for resolving
+ JMS Destinations.
+ message-converter
- A reference to the
- IMessageConverter strategy for
- converting NMS Messages to listener method arguments. Default is
- a SimpleMessageConverter.
+
+ A reference to the IMessageConverter
+ strategy for converting NMS Messages to listener method
+ arguments. Default is a
+ SimpleMessageConverter.
+ destination-type
- The NMS destination type for this listener:
- queue, topic or
- durableTopic. The default is
- queue.
+
+ The NMS destination type for this listener:
+ queue, topic or
+ durableTopic. The default is
+ queue.
+ client-id
- The NMS client id for this listener container.
- Needs to be specified when using durable
- subscriptions.
+
+ The NMS client id for this listener container. Needs to
+ be specified when using durable subscriptions.
+ acknowledge
- The native NMS acknowledge mode:
- auto, client,
- dups-ok or transacted. A
- value of transacted activates a locally
- transacted Session. As an
- alternative, specify the transaction-manager
- attribute described below. Default is
- auto.
+
+ The native NMS acknowledge mode:
+ auto, client,
+ dups-ok or transacted. A
+ value of transacted activates a locally
+ transacted Session. As an alternative,
+ specify the transaction-manager attribute
+ described below. Default is auto.
+ concurrency
- The number of concurrent sessions/consumers to
- start for each listener. Default is 1; keep concurrency limited
- to 1 in case of a topic listener or if queue ordering is
- important; consider raising it for general
- queues.
+
+ The number of concurrent sessions/consumers to start for
+ each listener. Default is 1; keep concurrency limited to 1 in
+ case of a topic listener or if queue ordering is important;
+ consider raising it for general queues.
+ recovery-interval
- The time interval between connection recovery
- attempts. The default is 5 seconds. Specify as a TimeSpan value
- using Spring's TimeSpanConverter (e.g. 10s, 10m, 3h, etc)
-
+
+ The time interval between connection recovery attempts.
+ The default is 5 seconds. Specify as a TimeSpan value using
+ Spring's TimeSpanConverter (e.g. 10s, 10m, 3h, etc)
+ max-recovery-time
- The maximum time try reconnection attempts. The
- default is 10 minutes. Specify as a TimeSpan value using
- Spring's TimeSpanConverter (e.g. 10s, 10m, 3h, etc)
-
+
+ The maximum time try reconnection attempts. The default
+ is 10 minutes. Specify as a TimeSpan value using Spring's
+ TimeSpanConverter (e.g. 10s, 10m, 3h, etc)
+
@@ -1425,4 +1446,4 @@ namespace MyApp
EmsTemplate
-
\ No newline at end of file
+
diff --git a/doc/reference/src/objects.xml b/doc/reference/src/objects.xml
index a7f02cc1..dae287b8 100644
--- a/doc/reference/src/objects.xml
+++ b/doc/reference/src/objects.xml
@@ -16,7 +16,12 @@
* limitations under the License.
*/
-->
-
+The IoC container
@@ -34,11 +39,11 @@
interface provides an advanced configuration mechanism capable of managing
objects of any nature. The IApplicationContext
- interface builds on top of the IObjectFactory (it
- is a sub-interface) and adds other functionality such as easier
- integration with Spring.NET's Aspect Oriented Programming (AOP) features,
- message resource handling (for use in internationalization), event
- propagation and application layer-specific context such as
+ interface builds on top of the IObjectFactory (it is a
+ sub-interface) and adds other functionality such as easier integration
+ with Spring.NET's Aspect Oriented Programming (AOP) features, message
+ resource handling (for use in internationalization), event propagation and
+ application layer-specific context such as
WebApplicationContext for use in web
applications.
@@ -47,9 +52,9 @@
IApplicationContext adds more enterprise-centric
functionality to it. The IApplicationContext is a
complete superset of the IObjectFactory, and any
- description of IObjectFactory capabilities and
- behavior should be considered to apply to
- IApplicationContexts as well.
+ description of IObjectFactory capabilities and behavior
+ should be considered to apply to IApplicationContexts
+ as well.
This chapter is divided into two parts, with the first part covering the basic principles
@@ -75,9 +80,9 @@
The container
- The IObjectFactory is the actual
- representation of the Spring IoC container that is responsible for
- instantiating, configuring, and managing a number of objects.
+ The IObjectFactory is the actual representation
+ of the Spring IoC container that is responsible for instantiating,
+ configuring, and managing a number of objects.The IObjectFactory interface is the central IoC
container interface in Spring. Its responsibilities include
@@ -85,11 +90,11 @@
and assembling the dependencies between these objects.There are a number of implementations of the
- IObjectFactory interface that come supplied
- straight out-of-the-box with Spring. The most commonly used
+ IObjectFactory interface that come supplied straight
+ out-of-the-box with Spring. The most commonly used
IObjectFactory implementation is the
- XmlObjectFactory class. This implementation
- allows you to express the objects that compose your application, and the
+ XmlObjectFactory class. This implementation allows
+ you to express the objects that compose your application, and the
doubtless rich interdependencies between such objects, in terms of XML.
The XmlObjectFactory takes this XML configuration
metadata and uses it to create a fully configured system or application.
@@ -97,12 +102,12 @@
discussed in . Additional
features offered by another implementation of
IObjectFactory, the
- IApplicationContext, are discussed in section
- .
+ IApplicationContext, are discussed in section .
-
+
@@ -186,10 +191,10 @@ IObjectFactory factory = context;
url="http://www.springframework.net/doc/api/html/Spring.Core.IO.IResource.html">IResource
abstraction. The IResource interface
provides a simple and uniform interface to a wide array of IO resources
- that can represent themselves as
- System.IO.Stream. An example for a file based
- resource, not using the URL syntax but an implementation of the
- IResource interface for file is shown below.[C#]
+ that can represent themselves as System.IO.Stream. An
+ example for a file based resource, not using the URL syntax but an
+ implementation of the IResource interface for file is shown
+ below.[C#]
IResource input = new FileSystemResource ("objects.xml");
IObjectFactory factory = new XmlObjectFactory(input);
@@ -223,9 +228,9 @@ IObjectFactory factory = new XmlObjectFactory(input);
</spring> The context type (specified as the value of
the type attribute of the context
element) is wholly optional, and defaults to the
- Spring.Context.Support.XmlApplicationContext
- class, so the following XML snippet is functionally equivalent to the
- first. <spring>
+ Spring.Context.Support.XmlApplicationContext class,
+ so the following XML snippet is functionally equivalent to the first.
+ <spring>
<context>
<resource uri="file://services.xml"/>
<resource uri="assembly://MyAssembly/MyDataAccess/data-access.xml"/>
@@ -234,15 +239,16 @@ IObjectFactory factory = new XmlObjectFactory(input);To acquire a reference to an
IApplicationContext using a custom configuration
- section, one simply uses the following code; IApplicationContext ctx = ContextRegistry.GetContext();
- The ContextRegistry is used to both instantiate
- the application context and to perform service locator style access to
- other objects. (See for more
+ section, one simply uses the following code; IApplicationContext ctx = ContextRegistry.GetContext();
+ The ContextRegistry is used to both instantiate the
+ application context and to perform service locator style access to other
+ objects. (See for more
information). The glue that makes this possible is an implementation of
the Base Class Library (BCL) provided
- IConfigurationSectionHandler interface, namely
- the Spring.Context.Support.ContextHandler class.
- The handler class needs to be registered in the
+ IConfigurationSectionHandler interface, namely the
+ Spring.Context.Support.ContextHandler class. The
+ handler class needs to be registered in the
configSections section of the .NET configuration file
as shown below. <configSections>
<sectionGroup name="spring">
@@ -254,12 +260,11 @@ IObjectFactory factory = new XmlObjectFactory(input);In some usage scenarios, user code will not have to explicitly
instantiate an appropriate implementation of the
- IObjectFactory interface, since Spring.NET code
- will do it. For example, the ASP.NET web layer provides support code to
- load a Spring.NET IApplicationContext
- automatically as part of the normal startup process of an ASP.NET web
- application. Similar support for WinForms applications is being
- investigated.
+ IObjectFactory interface, since Spring.NET code will
+ do it. For example, the ASP.NET web layer provides support code to load
+ a Spring.NET IApplicationContext automatically as
+ part of the normal startup process of an ASP.NET web application.
+ Similar support for WinForms applications is being investigated.
While programmatic manipulation of
IObjectFactory instances will be described later, the
@@ -279,9 +284,9 @@ IObjectFactory factory = new XmlObjectFactory(input);Your XML object definitions can also be defined within the
standard .NET application configuration file by registering the
- Spring.Context.Support.DefaultSectionHandler
- class as the configuration section handler for inline object
- definitions. This allows you to completely configure one or more
+ Spring.Context.Support.DefaultSectionHandler class as
+ the configuration section handler for inline object definitions. This
+ allows you to completely configure one or more
IApplicationContext instances within a single
standard .NET application configuration file as shown in the following
example. <configuration>
@@ -311,8 +316,8 @@ IObjectFactory factory = new XmlObjectFactory(input);
described in and
.
- The IApplicationContext can be configured
- to register other resource handlers, custom parsers to integrate
+ The IApplicationContext can be configured to
+ register other resource handlers, custom parsers to integrate
user-contributed XML schema into the object definitions section, type
converters, and define type aliases. These features are discussed in
section
@@ -525,7 +530,7 @@ IObjectFactory factory = new XmlObjectFactory(input);Aliasing objects
-
+
In an object definition itself, you may supply more than one
name for the object, by using a combination of the id and name
attributes as discussed in .
@@ -620,8 +625,8 @@ IObjectFactory factory = new XmlObjectFactory(input);
constructor (i.e. a constructor that has no parameters) in the source
code definition of your class.
- The XmlObjectFactory implementation of
- the IObjectFactory interface can consume object
+ The XmlObjectFactory implementation of the
+ IObjectFactory interface can consume object
definitions that have been defined in XML, for example...
<object id="exampleObject" type="Examples.ExampleObject, ExamplesLibrary"/>
@@ -631,16 +636,15 @@ IObjectFactory factory = new XmlObjectFactory(input);This XML fragment describes an object definition that will be
identified by the exampleObject name, instances
- of which will be of the Examples.ExampleObject
- type that has been compiled into the
- ExamplesLibrary assembly. Take special note of the
- structure of the type attribute's value... the
- namespace-qualified name of the class is specified, followed by a
- comma, followed by (at a bare minimum) the name of the assembly that
- contains the class. In the preceding example, the
- ExampleObject class is defined in the
- Examples namespace, and it has been compiled into
- the ExamplesLibrary assembly.
+ of which will be of the Examples.ExampleObject type
+ that has been compiled into the ExamplesLibrary
+ assembly. Take special note of the structure of the
+ type attribute's value... the namespace-qualified
+ name of the class is specified, followed by a comma, followed by (at a
+ bare minimum) the name of the assembly that contains the class. In the
+ preceding example, the ExampleObject class is
+ defined in the Examples namespace, and it has been
+ compiled into the ExamplesLibrary assembly.
The name of the assembly that contains the type
must be specified in the type
@@ -660,8 +664,8 @@ IObjectFactory factory = new XmlObjectFactory(input);If you have defined nested classes use the addition symbol, +,
to reference the nested class. For example, if the class
Examples.ExampleObject had a nested class
- Person the XML declaration would be
- <object id="exampleObject" type="Examples.ExampleObject+Person, ExamplesLibrary"/>
+ Person the XML declaration would be <object id="exampleObject" type="Examples.ExampleObject+Person, ExamplesLibrary"/>If you are defining classes that have been compiled into
assemblies that are available to your application (such as the
@@ -716,7 +720,8 @@ IObjectFactory factory = new XmlObjectFactory(input);
an object in the current (or parent/ancestor) container that contains
the instance method that is to be invoked to create the object. The
name of the factory method itself should still be set via the
- 'factory-method' attribute.<!-- the factory object, which contains an instance method called 'CreateInstance' -->
+ 'factory-method' attribute.<!-- the factory object, which contains an instance method called 'CreateInstance' -->
<object id="exampleFactory" type="...">
<!-- inject any dependencies required by this object -->
</object>
@@ -797,7 +802,8 @@ IObjectFactory factory = new XmlObjectFactory(input);
<alias name="GenericDictionary" type=" System.Collections.Generic.Dictionary<,>" />
<alias name="myDictionary" type="System.Collections.Generic.Dictionary<int,string>" />
</typeAliases>
- So that instead of something like this <object id="myGenericObject"
+ So that instead of something like this <object id="myGenericObject"
type="GenericsPlay.ExampleGenericObject<System.Collections.Generic.Dictionary<int , string>>, GenericsPlay" />
It can be shortened to <object id="myOtherGenericObject"
type="GenericsPlay.ExampleGenericObject<GenericDictionary<int , string>>, GenericsPlay" />
@@ -836,7 +842,8 @@ IObjectFactory factory = new XmlObjectFactory(input);
set { someStringKeyedDictionary = value; }
}
-} The accompanying factory class is
+} The accompanying factory class is
public class TestGenericObjectFactory
{
public static TestGenericObject<V, W> StaticCreateInstance<V, W>()
@@ -851,7 +858,8 @@ public class TestGenericObjectFactory
}
The XML snippet to create an instance of TestGenericObject
where V is a List of integers and
- W is an integer is shown below <object id="myTestGenericObject"
+ W is an integer is shown below <object id="myTestGenericObject"
type="GenericsPlay.TestGenericObjectFactory, GenericsPlay"
factory-method="StaticCreateInstance<System.Collections.Generic.List<int>,int>"
/> The StaticCreateInstance method is responsible for
@@ -878,9 +886,9 @@ public class TestGenericObjectFactory
Using the container
- An IApplicationContext is essentially
- nothing more than the interface for an advanced factory capable of
- maintaining a registry of different objects and their dependencies. The
+ An IApplicationContext is essentially nothing
+ more than the interface for an advanced factory capable of maintaining a
+ registry of different objects and their dependencies. The
IApplicationContext enables you to read object
definitions and access them. You create one and read in some object
definition in the XML format as follows:
@@ -891,10 +899,10 @@ public class TestGenericObjectFactory
Basically that is all there is to it. Using
GetObject(string) or the indexer
[string], you can retrieve instances of your object;
- the client-side view of the IApplicationContext
- is simple. The IApplicationContext interface has
- just a few other methods related to finding objects in the contianer,
- but ideally your application code should never use them... indeed, your
+ the client-side view of the IApplicationContext is
+ simple. The IApplicationContext interface has just a
+ few other methods related to finding objects in the contianer, but
+ ideally your application code should never use them... indeed, your
application code should have no calls to the
GetObject(string) method at all, and thus no
dependency on Spring APIs at all.
@@ -1268,8 +1276,8 @@ namespace SimpleApp
initialized with a configuration which describes all the
objects. Most Spring.NET users use an
IObjectFactory or
- IApplicationContext variant that supports
- XML format configuration files.
+ IApplicationContext variant that supports XML
+ format configuration files.
@@ -1294,16 +1302,16 @@ namespace SimpleApp
Each property
- or constructor argument which is a value must be able to be
- converted from whatever format it was specified in, to the
+ id="object-factory-collaborators-typeconverter">Each
+ property or constructor argument which is a value must be able
+ to be converted from whatever format it was specified in, to the
actual System.Type of that property or
constructor argument. By default Spring.NET can convert a value
supplied in string format to all built-in types, such as
int, long,
string, bool, etc.
- Spring.NET uses TypeConverter definitions
- to be able to convert string values to other, arbitrary types.
+ Spring.NET uses TypeConverter definitions to
+ be able to convert string values to other, arbitrary types.
Refer to for more
information regarding type conversion, and how you can design
your classes to be convertible by Spring.NET.
@@ -1316,11 +1324,11 @@ namespace SimpleApp
However, the object properties themselves are not set until the object
is actually created. For those object that defined as singletons and
set to be pre-instantiated (such as singleton object in an
- IApplicationContext), creation happens at the
- time that the container is created, but otherwise this is only when
- the object is requested. When an object actually has to be created,
- this will potentially cause a graph of other objects to be created, as
- its dependencies and its dependencies' dependencies (and so on) are
+ IApplicationContext), creation happens at the time
+ that the container is created, but otherwise this is only when the
+ object is requested. When an object actually has to be created, this
+ will potentially cause a graph of other objects to be created, as its
+ dependencies and its dependencies' dependencies (and so on) are
created and assigned.
@@ -1362,12 +1370,12 @@ namespace SimpleApp
that object or one of its dependencies. This could happen if the
object throws an exception as a result of a missing or invalid
property, for example. This potentially delayed visibility of some
- configuration issues is why IApplicationContext
- by default pre-instantiates singleton objects. At the cost of some
+ configuration issues is why IApplicationContext by
+ default pre-instantiates singleton objects. At the cost of some
upfront time and memory to create these objects before they are
actually needed, you find out about configuration issues when the
- IApplicationContext is created, not later. If
- you wish, you can still override this default behavior and set any of
+ IApplicationContext is created, not later. If you
+ wish, you can still override this default behavior and set any of
these singleton objects to lazy-load (not be preinstantiated)
If no circular dependencies are involved (see sidebar for a
@@ -1381,8 +1389,8 @@ namespace SimpleApp
configure' to mean that the object will be instantiated (if
not a pre-instantiated singleton), all of its dependencies will be
set, and the relevant lifecycle methods (such as a configured init
- method or the IIntializingObject callback
- method) will all be invoked.
+ method or the IIntializingObject callback method)
+ will all be invoked.
@@ -1390,7 +1398,8 @@ namespace SimpleApp
First, an example of using XML-based configuration metadata for
setter-based DI. Find below a smallpart of a Spring XML configuration
- file specifying some object definitions. <object id="exampleObject" type="Examples.ExampleObject, ExamplesLibrary">
+ file specifying some object definitions. <object id="exampleObject" type="Examples.ExampleObject, ExamplesLibrary">
<!-- setter injection using the ref attribute -->
<property name="objectOne" ref="anotherExampleObject"/>
@@ -1554,10 +1563,10 @@ public class MixedIocObject
The <value/> element specifies a
property or constructor argument as a human-readable string
representation. As mentioned previously,
- TypeConverter instances are used to convert
- these string values from a System.String to the
- actual property or argument type. Custom
- TypeConverter implementations in the
+ TypeConverter instances are used to convert these
+ string values from a System.String to the actual
+ property or argument type. Custom TypeConverter
+ implementations in the
Spring.Objects.TypeConverters namespace are used to
augment the functionality offered by the .NET BCL's default
TypeConverter implementations.
@@ -1615,7 +1624,8 @@ public class MixedIocObject
actual XML file, and the object name is the object
id, the local attribute may
be used, which will allow the XML parser itself to validate the
- object name even earlier, at parse time. <property name="targetName">
+ object name even earlier, at parse time. <property name="targetName">
<idref local="theTargetObject"/>
</property>
@@ -1629,9 +1639,9 @@ public class MixedIocObject
set the value of the specified property to be a reference to another
object managed by the container, a collaborator, so to speak. As you
saw in the previous example to set collection properties, we used the
- SqlConnection instance from the initial example
- as a collaborator and specified it using a <ref object/>
- element. As mentioned in a previous section, the referred-to object is
+ SqlConnection instance from the initial example as
+ a collaborator and specified it using a <ref object/> element.
+ As mentioned in a previous section, the referred-to object is
considered to be a dependency of the object who's property is being
set, and will be initialized on demand as needed (if it is a singleton
object it may have already been initialized by the container) before
@@ -1644,8 +1654,8 @@ public class MixedIocObject
object attribute of the ref tag
is the most general form, and will allow creating a reference to any
object in the same IObjectFactory /
- IApplicationContext (whether or not in the same
- XML file), or parent IObjectFactory /
+ IApplicationContext (whether or not in the same XML
+ file), or parent IObjectFactory /
IApplicationContext. The value of the
object attribute may be the same as either the
id attribute of the target object, or one of the
@@ -1673,11 +1683,11 @@ public class MixedIocObject
values in the name attribute of the target object,
and the target object must be in a
parent IObjectFactory or
- IApplicationContext of the current one. The
- main use of this object reference variant is when there is a need to
- wrap an existing object in a parent context with some sort of proxy
- (which may have the same name as the parent), and needs the original
- object so it may wrap it.
+ IApplicationContext of the current one. The main
+ use of this object reference variant is when there is a need to wrap
+ an existing object in a parent context with some sort of proxy (which
+ may have the same name as the parent), and needs the original object
+ so it may wrap it.
<ref parent="someObject"/>
@@ -1781,25 +1791,24 @@ public class MixedIocObject
Spring supports setting values for classes that expose
properties based on the generic collection interfaces
- IList<T> and
- IDictionary<TKey, TValue>. The type
- parameter for these collections is specified by using the XML
- attribute element-type for
- IList<T> and the XML attributes
+ IList<T> and IDictionary<TKey,
+ TValue>. The type parameter for these collections is
+ specified by using the XML attribute element-type
+ for IList<T> and the XML attributes
key-type and value-type for
- IDictionary<TKey, TValue>. The values of
- the collection are automaticaly converted from a string to the
- appropriate type. If you are using your own user-defined type as a
- generic type parameter you will likely need to register a custom type
- converter. Refer to for
- more information. The implementations of
- IList<T> and
- IDictionary<TKey, TValue> that is created
+ IDictionary<TKey, TValue>. The values of the
+ collection are automaticaly converted from a string to the appropriate
+ type. If you are using your own user-defined type as a generic type
+ parameter you will likely need to register a custom type converter.
+ Refer to for more
+ information. The implementations of IList<T>
+ and IDictionary<TKey, TValue> that is created
are System.Collections.Generic.List and
System.Collections.Generic.Dictionary.The following class represents a lottery ticket and demonstrates
- how to set the values of a generic IList. public class LotteryTicket {
+ how to set the values of a generic IList. public class LotteryTicket {
List<int> list;
@@ -1833,10 +1842,11 @@ public class MixedIocObject
demonstrates the use of generics using the
Spring.Expressions.IExpression interface as the
generic type parameter for the IList element-type and the value-type
- for IDictionary. Spring.Expressions.IExpression
- has an associated type converter,
+ for IDictionary. Spring.Expressions.IExpression has
+ an associated type converter,
Spring.Objects.TypeConverters.ExpressionConverter
- that is already pre-registered with Spring. public class GenericExpressionHolder
+ that is already pre-registered with Spring. public class GenericExpressionHolder
{
private System.Collections.Generic.IList<IExpression> expressionsList;
@@ -2001,7 +2011,8 @@ public class MixedIocObject
<entry key="myKey">
<value>hello</value>
-</entry> are equivalent to:<property name="myProperty" value="hello"/>
+</entry> are equivalent to:<property name="myProperty" value="hello"/>
<constructor-arg value="hello"/>
@@ -2019,7 +2030,8 @@ public class MixedIocObject
<constructor-arg index="0">
<ref object="anotherObject"/>
-</constructor-arg> is equivalent to... <property name="myProperty" ref="anotherObject"/>
+</constructor-arg> is equivalent to... <property name="myProperty" ref="anotherObject"/>
<constructor-arg index="0" ref="anotherObject"/>
@@ -2031,12 +2043,14 @@ public class MixedIocObject
Finally, the entry element allows a shortcut form the specify
the key and/or value of a dictionary, in the form of key/key-ref and
- value/value-ref attributes. Therefore, the following <entry>
+ value/value-ref attributes. Therefore, the following <entry>
<key>
<ref object="MyKeyObject"/>
</key>
<ref object="MyValueObject"/>
-</entry> Is equivalent to: <entry key-ref="MyKeyObject" value-ref="MyValueObject"/>
+</entry> Is equivalent to: <entry key-ref="MyKeyObject" value-ref="MyValueObject"/>
As mentioned previously, the equivalence is to <ref
object="xxx"> and not the local or parent forms of object
references.
@@ -2087,7 +2101,8 @@ public class MixedIocObject
attribute may be used to explicitly force one or more objects to be
initialized before the object using this element is initialized. Find
below an example of using the 'depends-on' attribute
- to express a dependency on a single object.. <object id="objectOne" type="Examples.ExampleObject, ExamplesLibrary" depends-on="manager">
+ to express a dependency on a single object.. <object id="objectOne" type="Examples.ExampleObject, ExamplesLibrary" depends-on="manager">
<property name="manager" ref="manager"/>
</object>
@@ -2119,20 +2134,20 @@ public class MixedIocObject
Lazily-instantiated objects
- The default behavior for
- IApplicationContext implementations is to eagerly
- pre-instantiate all singleton objects at startup. Pre-instantiation
- means that an IApplicationContext will eagerly
- create and configure all of its singleton objects as part of its
- initialization process. Generally this is a good thing, because it means
- that any errors in the configuration or in the surrounding environment
- will be discovered immediately (as opposed to possibly hours or even
- days down the line).
+ The default behavior for IApplicationContext
+ implementations is to eagerly pre-instantiate all singleton objects at
+ startup. Pre-instantiation means that an
+ IApplicationContext will eagerly create and configure
+ all of its singleton objects as part of its initialization process.
+ Generally this is a good thing, because it means that any errors in the
+ configuration or in the surrounding environment will be discovered
+ immediately (as opposed to possibly hours or even days down the
+ line).However, there are times when this behavior is not what is wanted.
If you do not want a singleton object to be pre-instantiated when using
- an IApplicationContext, you can selectively
- control this by marking an object definition as lazy-initialized. A
+ an IApplicationContext, you can selectively control
+ this by marking an object definition as lazy-initialized. A
lazily-initialized object indicates to the IoC container whether or not
an object instance should be created at startup or when it is first
requested.
@@ -2155,13 +2170,13 @@ public class MixedIocObject
though an object definition may be marked up as being lazy-initialized,
if the lazy-initialized object is the dependency of a singleton object
that is not lazy-initialized, when the
- IApplicationContext is eagerly pre-instantiating
- the singleton, it will have to satisfy all of the singletons
- dependencies, one of which will be the lazy-initialized object! So don't
- be confused if the IoC container creates one of the objects that you
- have explicitly configured as lazy-initialized at startup; all that
- means is that the lazy-initialized object is being injected into a
- non-lazy-initialized singleton object elsewhere.
+ IApplicationContext is eagerly pre-instantiating the
+ singleton, it will have to satisfy all of the singletons dependencies,
+ one of which will be the lazy-initialized object! So don't be confused
+ if the IoC container creates one of the objects that you have explicitly
+ configured as lazy-initialized at startup; all that means is that the
+ lazy-initialized object is being injected into a non-lazy-initialized
+ singleton object elsewhere.
It is also possible to control lazy-initialization at the
container level by using the
@@ -2236,14 +2251,14 @@ public class MixedIocObject
This option gives you the ability to resolve
collaborators by type instead of by name. Supposing you have
- an IObjectDefinition with a
- collaborator typed SqlConnection,
- Spring.NET will search the entire object factory for an object
- definition of type SqlConnection and
- use it as the collaborator. If 0 (zero) or more than
- 1 (one) object definitions of the desired type exist in the
- container, a failure will be reported and you won't be able to
- use autowiring for that specific object.
+ an IObjectDefinition with a collaborator
+ typed SqlConnection, Spring.NET will search
+ the entire object factory for an object definition of type
+ SqlConnection and use it as the
+ collaborator. If 0 (zero) or more than 1 (one)
+ object definitions of the desired type exist in the container,
+ a failure will be reported and you won't be able to use
+ autowiring for that specific object.
@@ -2640,13 +2655,13 @@ public class ReplacementComputeValue : IMethodReplacer
method invocation into a constructor (as an argument) or as the value of
a property setter. Similarly,
PropertyRetrievingFactoryObject and
- FieldRetrievingFactoryObject allow you to
- retrieve values from another object's property or field value. These
- classes implement the IFactoryObject interface
- which indicates to Spring.NET that this object is itself a factory and
- the factories product, not the factory itself, is what will be
- associated with the object id. Factory objects are discussed further in
-
+ FieldRetrievingFactoryObject allow you to retrieve
+ values from another object's property or field value. These classes
+ implement the IFactoryObject interface which
+ indicates to Spring.NET that this object is itself a factory and the
+ factories product, not the factory itself, is what will be associated
+ with the object id. Factory objects are discussed further in Setting a reference to the value of property.
@@ -2661,23 +2676,23 @@ public class ReplacementComputeValue : IMethodReplacer
must obviously be static).
In the case of a property exposed on an instance, the target
- object that a PropertyRetrievingFactoryObject
- will evaluate can be either an object instance specified directly
- inline or a reference to another arbitrary object. In the case of a
- static property exposed on a class, the target object will be the
- class (the .NET System.Type) exposing the
- property.
+ object that a PropertyRetrievingFactoryObject will
+ evaluate can be either an object instance specified directly inline or
+ a reference to another arbitrary object. In the case of a static
+ property exposed on a class, the target object will be the class (the
+ .NET System.Type) exposing the property.
The result of evaluating the property lookup may then be used in
another object definition as a property value or constructor argument.
Note that nested properties are supported for both instance and class
- property lookups. The IFactoryObject is
- discussed more generally in IFactoryObject is discussed
+ more generally in .Here's an example where a property path is used against another
object instance. In this case, an inner object definition is used and
- the property path is nested, i.e. spouse.age. <object name="person" type="Spring.Objects.TestObject, Spring.Core.Tests">
+ the property path is nested, i.e. spouse.age. <object name="person" type="Spring.Objects.TestObject, Spring.Core.Tests">
<property name="age" value="20"/>
<property name="spouse">
<object type="Spring.Objects.TestObject, Spring.Core.Tests">
@@ -2732,8 +2747,8 @@ public class ReplacementComputeValue : IMethodReplacer
The FieldRetrievingFactoryObject class
addresses much the same area of concern as the
- PropertyRetrievingFactoryObject described in
- the previous section. However, as its name might suggest, the
+ PropertyRetrievingFactoryObject described in the
+ previous section. However, as its name might suggest, the
FieldRetrievingFactoryObject class is concerned
with looking up the value of a public
field exposed on either an instance or a class (and similarly, in the
@@ -2741,8 +2756,8 @@ public class ReplacementComputeValue : IMethodReplacer
static).The following example demonstrates using a
- FieldRetrievingFactoryObject to look up the
- value of a (public, static) field exposed on a class
+ FieldRetrievingFactoryObject to look up the value
+ of a (public, static) field exposed on a class<object id="withTypesField"
type="Spring.Objects.Factory.Xml.XmlObjectFactoryTests+MyTestObject, Spring.Core.Tests">
@@ -2779,24 +2794,22 @@ public class ReplacementComputeValue : IMethodReplacer
Setting a property or constructor argument to the return value
of a method invocation.
- The MethodInvokingFactoryObject rounds
- out the trio of classes that permit the setting of properties and
+ The MethodInvokingFactoryObject rounds out
+ the trio of classes that permit the setting of properties and
constructor arguments using the members of other objects and classes.
Whereas the PropertyRetrievingFactoryObject and
FieldRetrievingFactoryObject classes dealt with
simply looking up and returning the value of property or field on an
- object or class, the
- MethodInvokingFactoryObject allows one to set a
- constructor or property to the return value of an arbitrary method
- invocation,
+ object or class, the MethodInvokingFactoryObject
+ allows one to set a constructor or property to the return value of an
+ arbitrary method invocation,
- The MethodInvokingFactoryObject class
- handles both the case of invoking an (instance) method on another
- object in the container, and the case of a static method call on an
- arbitrary class. Additionally, it is sometimes necessary to invoke a
- method just to perform some sort of initialization.... while the
- mechanisms for handling object initialization have yet to be
- introduced (see The MethodInvokingFactoryObject class handles
+ both the case of invoking an (instance) method on another object in
+ the container, and the case of a static method call on an arbitrary
+ class. Additionally, it is sometimes necessary to invoke a method just
+ to perform some sort of initialization.... while the mechanisms for
+ handling object initialization have yet to be introduced (see ), these
mechanisms do not permit any arguments to be passed to any
initialization method, and are confined to invoking an initialization
@@ -2807,8 +2820,8 @@ public class ReplacementComputeValue : IMethodReplacer
The following example (in an XML based
IObjectFactory definition) uses the
- MethodInvokingFactoryObject class to force a
- call to a static factory method prior to the instantiation of the
+ MethodInvokingFactoryObject class to force a call
+ to a static factory method prior to the instantiation of the
object...<object id="force-init"
@@ -2825,16 +2838,16 @@ public class ReplacementComputeValue : IMethodReplacer
thus the calling of its configured StaticMethod
static initializer method, when myService is first
initialized. Please note that in order to effect this initialization,
- the MethodInvokingFactoryObject object
- must be operating in
+ the MethodInvokingFactoryObject object must be operating in
singleton mode (the default.. see the next
paragraph).Note that since this class is expected to be used primarily for
accessing factory methods, this factory defaults to operating in
singleton mode. As such, as soon as all of the
- properties for a MethodInvokingFactoryObject
- object have been set, and if the
+ properties for a MethodInvokingFactoryObject object
+ have been set, and if the
MethodInvokingFactoryObject object is still in
singleton mode, the method will be invoked
immediately and the return value cached for later access. The first
@@ -2864,8 +2877,8 @@ public class ReplacementComputeValue : IMethodReplacer
arguments is significant... the order of the values passed to the
Arguments property must be the same as the
order of the arguments defined on the method signature, including the
- argument Type. This is shown in the example
- below <object id="myObject" type="Spring.Objects.Factory.Config.MethodInvokingFactoryObject, Spring.Core">
+ argument Type. This is shown in the example below
+ <object id="myObject" type="Spring.Objects.Factory.Config.MethodInvokingFactoryObject, Spring.Core">
<property name="TargetType" value="Whatever.MyClassFactory, MyAssembly"/>
<property name="TargetMethod" value="GetInstance"/>
@@ -2882,11 +2895,11 @@ public class ReplacementComputeValue : IMethodReplacer
The second way involves passing an arguments dictionary to the
NamedArguments property... this dictionary
- maps argument names (Strings) to argument
- values (any object). The argument names are not case-sensitive, and
- order is (obviously) not significant (since dictionaries by definition
- do not have an order). This is shown in the example below
- <object id="myObject" type="Spring.Objects.Factory.Config.MethodInvokingFactoryObject, Spring.Core">
+ maps argument names (Strings) to argument values
+ (any object). The argument names are not case-sensitive, and order is
+ (obviously) not significant (since dictionaries by definition do not
+ have an order). This is shown in the example below <object id="myObject" type="Spring.Objects.Factory.Config.MethodInvokingFactoryObject, Spring.Core">
<property name="TargetObject">
<object type="Whatever.MyClassFactory, MyAssembly"/>
</property>
@@ -2917,12 +2930,13 @@ public class ReplacementComputeValue : IMethodReplacer
invoked to the surrounding factory object.Finally, if you want to use
- MethodInvokingFactoryObject in conjunction with
- a method that has a variable length argument list, then please note
- that the variable arguments need to be passed (and configured) as a
+ MethodInvokingFactoryObject in conjunction with a
+ method that has a variable length argument list, then please note that
+ the variable arguments need to be passed (and configured) as a
list. Let us consider the following method
- definition that uses the params keyword (in
- C#), and its attendant (XML) configuration... [C#]
+ definition that uses the params keyword (in C#),
+ and its attendant (XML) configuration... [C#]
public class MyClassFactory
{
public object CreateObject(Type objectType, params string[] arguments)
@@ -2950,25 +2964,23 @@ public class MyClassFactory
Provided IFactoryObject implementations
- In addition to
- PropertyRetrievingFactoryObject,
+ In addition to PropertyRetrievingFactoryObject,
MethodInvokingFactoryObject, and
- FieldRetrievingFactoryObject Spring.NET comes
- with other useful implementations of the
- IFactoryObject interface. These are discussed
- below.
+ FieldRetrievingFactoryObject Spring.NET comes with
+ other useful implementations of the IFactoryObject
+ interface. These are discussed below.Common logging
- The LogFactoryObject is useful when you
- would like to share a Common.Logging log object across a number of
- classes instead of creating a logging instance per class or class
- hierarchy. Information on the Common.Logging project can be found
- here. In the
- example shown below the same logging instance, with a logging category
- name of "DAOLogger", is used in both the SimpleAccountDao and
- SimpleProductDao data access objects. <objects xmlns="http://www.springframework.net"
+ The LogFactoryObject is useful when you would
+ like to share a Common.Logging log object across a number of classes
+ instead of creating a logging instance per class or class hierarchy.
+ Information on the Common.Logging project can be found here. In the example
+ shown below the same logging instance, with a logging category name of
+ "DAOLogger", is used in both the SimpleAccountDao and SimpleProductDao
+ data access objects. <objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net
http://www.springframework.net/xsd/spring-objects.xsd" >
@@ -3197,18 +3209,18 @@ public class MyClassFactory
to another. When using the XML based file to configure the IoC container,
string based property values are converted to the target property type.
Spring will rely on the standard .NET support for type conversion unless
- an alternative TypeConverter is registered for a
- given type. How to register custom TypeConverters will be described
- shortly. As a reminder, the standard .NET type converter support works by
- associating a TypeConverter attribute with the
- class definition by passing the type of the converter as an attribute
- argument.
+ an alternative TypeConverter is registered for a given
+ type. How to register custom TypeConverters will be described shortly. As
+ a reminder, the standard .NET type converter support works by associating
+ a TypeConverter attribute with the class definition by
+ passing the type of the converter as an attribute argument. More information about creating custom
TypeConverter implementations can be found online
at Microsoft's MSDN website, by searching for Implementing a
Type Converter. For example, an abbreviated class definition for the BCL
- type Font is shown below. [Serializable, TypeConverter(typeof(FontConverter)), ...]
+ type Font is shown below. [Serializable, TypeConverter(typeof(FontConverter)), ...]
public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDisposable
{
// Methods
@@ -3220,11 +3232,11 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
Type Conversion for EnumerationsThe default type converter for enumerations is the
- System.ComponentModel.EnumConverter class. To
- specify the value for an enumerated property, simply use the name of the
+ System.ComponentModel.EnumConverter class. To specify
+ the value for an enumerated property, simply use the name of the
property. For example the TestObject class has a
- property of the enumerated type FileMode. One of
- the values for this enumeration is named Create. The
+ property of the enumerated type FileMode. One of the
+ values for this enumeration is named Create. The
following XML fragment shows how to configure this property<object id="rod" type="Spring.Objects.TestObject, Spring.Core.Tests">
@@ -3237,10 +3249,9 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
Built-in TypeConvertersSpring.NET pre-registers a number of custom
- TypeConverter instances (for example, to convert
- a type expressed as a string into a real
- System.Type object). Each of those is listed
- below and they are all located in the
+ TypeConverter instances (for example, to convert a
+ type expressed as a string into a real System.Type
+ object). Each of those is listed below and they are all located in the
Spring.Objects.TypeConverters namespace of the
Spring.Core library.
@@ -3364,9 +3375,9 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
Spring.NET uses the standard .NET mechanisms for the resolution of
- System.Types, including, but not limited to
- checking any configuration files associated with your application,
- checking the Global Assembly Cache (GAC), and assembly probing.
+ System.Types, including, but not limited to checking
+ any configuration files associated with your application, checking the
+ Global Assembly Cache (GAC), and assembly probing.
@@ -3379,8 +3390,8 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
IObjectFactory or
IApplicationContext is to use the custom
configuration section handler
- TypeConverterSectionHandler This is demonstrated
- in section
+ TypeConverterSectionHandler This is demonstrated in
+ section An alternate approach, present for legacy reasons in the port of
Spring.NET from the Java code base, is to use the object factory
@@ -3397,10 +3408,9 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
Using CustomConverterConfigurerThis section shows in detail how to define a custom type
- converter that does not use the .NET
- TypeConverter attribute. The type converter
- class is standalone and inherits from the
- TypeConverter class. It uses the legacy factory
+ converter that does not use the .NET TypeConverter
+ attribute. The type converter class is standalone and inherits from
+ the TypeConverter class. It uses the legacy factory
post-processor approach.Consider a user class ExoticType, and
@@ -3471,8 +3481,8 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
} Finally, we use the
CustomConverterConfigurer to register the new
TypeConverter with the
- IApplicationContext, which will then be able to
- use it as needed: <object id="customConverterConfigurer"
+ IApplicationContext, which will then be able to use
+ it as needed: <object id="customConverterConfigurer"
type="Spring.Objects.Factory.Config.CustomConverterConfigurer, Spring.Core">
<property name="CustomConverters">
<dictionary>
@@ -3503,12 +3513,12 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
objects.Internally, Spring.NET uses implementations of the
- IObjectPostProcessor interface to process any
- marker interfaces it can find and call the appropriate methods. If you
- need custom features or other lifecycle behavior Spring.NET doesn't
- offer out-of-the-box, you can implement an
- IObjectPostProcessor yourself. More information
- about this can be found in IObjectPostProcessor interface to process any marker
+ interfaces it can find and call the appropriate methods. If you need
+ custom features or other lifecycle behavior Spring.NET doesn't offer
+ out-of-the-box, you can implement an
+ IObjectPostProcessor yourself. More information about
+ this can be found in .All the different lifecycle marker interfaces are described
@@ -3521,8 +3531,8 @@ public sealed class Font : MarshalByRefObject, ICloneable, ISerializable, IDispo
Spring.Objects.Factory.IInitializingObject
interface gives you the ability to perform initialization work after
all the necessary properties on an object are set by the container.
- The IInitializingObject interface specifies
- exactly one method:
+ The IInitializingObject interface specifies exactly
+ one method: void AfterPropertiesSet(): called
after all properties have been set by the container. This method
@@ -3588,19 +3598,19 @@ public class AnotherExampleObject : IInitializingObject
IDisposable / destroy-method
- The System.IDisposable interface provides
- you with the ability to get a callback when an
+ The System.IDisposable interface provides you
+ with the ability to get a callback when an
IObjectFactory is destroyed. The
- IDisposable interface specifies exactly one
- method:
+ IDisposable interface specifies exactly one method:
+ void Dispose(): and is called on
destruction of the container. This allows you to release any
resources you are keeping in this object (such as database
connections). You can throw anyException here... however, any such
- Exception will not stop the destruction
- of the container - it will only get logged.
+ Exception will not stop the destruction of
+ the container - it will only get logged.
@@ -3652,22 +3662,20 @@ public class AnotherExampleObject : IDisposable
This allows objects to manipulate the
- IObjectFactory that created them
- Programatically, through the IObjectFactory
- interface, or by casting the reference to a known subclass of this
- which exposes additional functionality. Primarily this would consist
- of programmatic retrieval of other objects. While there are cases when
- this capability is useful, it should generally be avoided, since it
- couples the code to Spring.NET, and does not follow the Inversion of
- Control style, where collaborators are provided to objects as
- properties.
+ IObjectFactory that created them Programatically,
+ through the IObjectFactory interface, or by casting
+ the reference to a known subclass of this which exposes additional
+ functionality. Primarily this would consist of programmatic retrieval
+ of other objects. While there are cases when this capability is
+ useful, it should generally be avoided, since it couples the code to
+ Spring.NET, and does not follow the Inversion of Control style, where
+ collaborators are provided to objects as properties.
IObjectNameAware
- The
- Spring.Objects.Factory.IObjectNameAware
+ The Spring.Objects.Factory.IObjectNameAware
interface gives you the ability to let the container set the name of
the object definition on the object instance itself. In those cases
where your object needs to know what its name is, implement this
@@ -3695,13 +3703,13 @@ public class AnotherExampleObject : IDisposable
When working with an IObjectFactory
Programatically, child object definitions are represented by the
- ChildObjectDefinition class. Most users will never
- work with them on this level, instead configuring object definitions
- declaratively in something like the
- XmlObjectFactory. In an
- XmlObjectFactory object definition, a child object
- definition is indicated simply by using the parent attribute, specifying
- the parent object definition as the value of this attribute.
+ ChildObjectDefinition class. Most users will never work
+ with them on this level, instead configuring object definitions
+ declaratively in something like the XmlObjectFactory.
+ In an XmlObjectFactory object definition, a child
+ object definition is indicated simply by using the parent attribute,
+ specifying the parent object definition as the value of this
+ attribute.<object id="inheritedTestObject" type="Spring.Objects.TestObject, Spring.Core.Tests">
<property name="name" value="parent"/>
@@ -3771,17 +3779,18 @@ public class AnotherExampleObject : IDisposable
The Spring container is essentially nothing more than an advanced
factory capable of maintaining a registry of different objects and their
- dependencies. The IObjectFactory enables you to
- read object definitions and access them using the object factory. When
- using just the IObjectFactory you would create an
- instance of one and then read in some object definitions in the XML format
- as follows: [C#]
+ dependencies. The IObjectFactory enables you to read
+ object definitions and access them using the object factory. When using
+ just the IObjectFactory you would create an instance of
+ one and then read in some object definitions in the XML format as follows:
+ [C#]
IResource input = new FileSystemResource ("objects.xml");
XmlObjectFactory factory = new XmlObjectFactory(input);That is pretty much it. Using GetObject(string)
(or the more concise indexer method factory ["string"])
- you can retrieve instances of your objects... [C#]
+ you can retrieve instances of your objects... [C#]
object foo = factory.GetObject ("foo"); // gets the object defined as 'foo'
object bar = factory ["bar"]; // same thing, just using the indexer
@@ -3801,9 +3810,9 @@ Console.WriteLine (three == four); // prints 'false'
The client-side view of the IObjectFactory is
- surprisingly simple. The IObjectFactory interface
- has only seven methods (and the aforementioned indexer) for clients to
- call:
+ surprisingly simple. The IObjectFactory interface has
+ only seven methods (and the aforementioned indexer) for clients to call:
+ bool ContainsObject(string): returns true
if the IObjectFactory contains an object
@@ -3814,18 +3823,18 @@ Console.WriteLine (three == four); // prints 'false'
object GetObject(string): returns an
instance of the object registered under the given name. Depending on
how the object was configured by the
- IObjectFactory configuration, either a
- singleton (and thus shared) instance or a newly created object will
- be returned. An ObjectsException will be thrown
- when either the object could not be found (in which case it'll be a
+ IObjectFactory configuration, either a singleton
+ (and thus shared) instance or a newly created object will be
+ returned. An ObjectsException will be thrown when
+ either the object could not be found (in which case it'll be a
NoSuchObjectDefinitionException), or an exception
occurred while instantiated and preparing the object.Object this [string]: this is the indexer
- for the IObjectFactory interface. It
- functions in all other respects in exactly the same way as the
+ for the IObjectFactory interface. It functions in
+ all other respects in exactly the same way as the
GetObject(string) method. The rest of this
documentation will always refer to the
GetObject(string) method, but be aware that you
@@ -3836,8 +3845,8 @@ Console.WriteLine (three == four); // prints 'false'
Object GetObject(string, Type): returns an
object, registered under the given name. The object returned will be
- cast to the given Type. If the object could
- not be cast, corresponding exceptions will be thrown
+ cast to the given Type. If the object could not
+ be cast, corresponding exceptions will be thrown
(ObjectNotOfRequiredTypeException). Furthermore,
all rules of the GetObject(string) method apply
(see above).
@@ -3878,8 +3887,8 @@ Console.WriteLine (three == four); // prints 'false'
A sub-interface of IObjectFactory,
- IConfigurableObjectFactory adds some convenient
- methods such as
+ IConfigurableObjectFactory adds some convenient methods
+ such as
@@ -3926,11 +3935,10 @@ Console.WriteLine (three == four); // prints 'false'
The IoC component of the Spring Framework has been designed for
extension. There is typically no need for an application developer to
subclass any of the various IObjectFactory or
- IApplicationContext implementation classes. The
- Spring IoC container can be infinitely extended by plugging in
- implementations of special integration interfaces. The next few sections
- are devoted to detailing all of these various integration
- interfaces.
+ IApplicationContext implementation classes. The Spring
+ IoC container can be infinitely extended by plugging in implementations of
+ special integration interfaces. The next few sections are devoted to
+ detailing all of these various integration interfaces.
Customizing objects with
@@ -3947,15 +3955,14 @@ Console.WriteLine (three == four); // prints 'false'
IObjectPostProcessor implementations.
You can configure multiple
- IObjectPostProcessors if you wish. You can
- control the order in which these
- IObjectPostProcessor execute by setting the
- 'Order' property (you can only set this property if the
+ IObjectPostProcessors if you wish. You can control
+ the order in which these IObjectPostProcessor execute
+ by setting the 'Order' property (you can only set this property if the
IObjectPostProcessor implements the
IOrdered interface; if you write your own
- IObjectPostProcessor you should consider
- implementing the IOrdered interface too); consult
- the SDK docs for the IObjectPostProcessor and
+ IObjectPostProcessor you should consider implementing
+ the IOrdered interface too); consult the SDK docs for
+ the IObjectPostProcessor and
IOrdered interfaces for more details.
@@ -3965,20 +3972,20 @@ Console.WriteLine (three == four); // prints 'false'
IObjectPostProcessors get a chance to do their
stuff. If you want to change the actual object definition (that is the
recipe that defines the object), then you rather need to use a
- IObjectFactoryPostProcessor (described below in
- the section entitled IObjectFactoryPostProcessor (described below in the
+ section entitled Customizing
configuration metadata with
IObjectFactoryPostProcessors.
Also, IObjectPostProcessors are scoped
per-container. This is only relevant if you are using container
- hierarchies. If you define a
- IObjectPostProcessor in one container, it will
- only do its stuff on the objects in that container. Objects that are
- defined in another container will not be post-processed by
- IObjectPostProcessors in another container,
- even if both containers are part of the same hierarchy.
+ hierarchies. If you define a IObjectPostProcessor
+ in one container, it will only do its stuff on the objects in that
+ container. Objects that are defined in another container will not be
+ post-processed by IObjectPostProcessors in another
+ container, even if both containers are part of the same
+ hierarchy.
The
@@ -3993,18 +4000,17 @@ object PostProcessAfterInitialization(object instance, string name);before any initialization methods
(such as the AfterPropertiesSet method of the
- IInitializingObject interface and any declared
- init method) are called, and also afterwards. The post-processor is free
- to do what it wishes with the object, including ignoring the callback
+ IInitializingObject interface and any declared init
+ method) are called, and also afterwards. The post-processor is free to
+ do what it wishes with the object, including ignoring the callback
completely. An object post-processor will typically check for marker
interfaces, or do something such as wrap an object with a proxy. Some
Spring.NET AOP infrastructure classes are implemented as object
post-processors as they do this proxy-wrapping logic.Other extensions to the IObjectPostProcessors
- interface are
- IInstantiationAwareObjectPostProcessor and
- IDestructionAwareObjectPostProcessor defined
+ interface are IInstantiationAwareObjectPostProcessor
+ and IDestructionAwareObjectPostProcessor defined
below public interface IInstantiationAwareObjectPostProcessor : IObjectPostProcessor
{
object PostProcessBeforeInstantiation(Type objectType, string objectName);
@@ -4036,22 +4042,21 @@ public interface IDestructionAwareObjectPostProcessor : IObjectPostProcessor
processing such as making sure that a property is set to a value if it
contains a [Required] attribute or to perform
attribute based wiring, i.e. adding the attribute
- [Inject("objectName")] on a property. Both of
- these features are scheduled to be included in Spring .12.
+ [Inject("objectName")] on a property. Both of these
+ features are scheduled to be included in Spring .12.
The IDestructionAwareObjectPostProcessor
callback contains a single method,
- PostProcessBeforeDestruction, which is called
- before a singleton's destroy method is invoked.
+ PostProcessBeforeDestruction, which is called before
+ a singleton's destroy method is invoked.
- It is important to know that the
- IObjectFactory treats object post-processors
- slightly differently than the
+ It is important to know that the IObjectFactory
+ treats object post-processors slightly differently than the
IApplicationContext. An
IApplicationContext will automatically detect any
objects which are deployed into it that implement the
- IObjectPostProcessor interface, and register them
- as post-processors, to be then called appropriately by the factory on
+ IObjectPostProcessor interface, and register them as
+ post-processors, to be then called appropriately by the factory on
object creation. Nothing else needs to be done other than deploying the
post-processor in a similar fashion to any other object. On the other
hand, when using plain IObjectFactories, object
@@ -4065,21 +4070,21 @@ factory.AddObjectPostProcessor(pp);
...This explicit registration step is not convenient, and this is one
- of the reasons why the various
- IApplicationContext implementations are preferred
- above plain IObjectFactory implementations in the
- vast majority of Spring-backed applications, especially when using
+ of the reasons why the various IApplicationContext
+ implementations are preferred above plain
+ IObjectFactory implementations in the vast majority
+ of Spring-backed applications, especially when using
IObjectPostProcessors.IObjectPostProcessors and AOP auto-proxyingClasses that implement the
- IObjectPostProcessor interface are special, and
- so they are treated differently by the container. All
- IObjectPostProcessors and their directly
- referenced object will be instantiated on startup, as part of the
- special startup phase of the IApplicationContext, then all those
+ IObjectPostProcessor interface are special, and so
+ they are treated differently by the container. All
+ IObjectPostProcessors and their directly referenced
+ object will be instantiated on startup, as part of the special startup
+ phase of the IApplicationContext, then all those
IObjectPostProcessors will be registered in a
sorted fashion - and applied to all further objects. Since AOP
auto-proxying is implemented as a
@@ -4088,8 +4093,8 @@ factory.AddObjectPostProcessor(pp);
objects are eligible for auto-proxying (and thus will not have aspects
'woven' into them). For any such object, you should see an info log
message: “Object 'foo' is not eligible for getting processed by all
- IObjectPostProcessors (for example: not
- eligible for auto-proxying)â€.
+ IObjectPostProcessors (for example: not eligible
+ for auto-proxying)â€.
@@ -4188,8 +4193,8 @@ DEBUG - MovieApp Done.
being 'required-to-be-set' (i.e. an setter
property with this attribute applied must be configured to be
dependency injected with a value), else an
- ObjectInitializationException will be thrown by
- the container at runtime.
+ ObjectInitializationException will be thrown by the
+ container at runtime.
The best way to illustrate the usage of this attribute is with
an example.
@@ -4236,22 +4241,22 @@ DEBUG - MovieApp Done.
appropriately.
This component is the
- RequiredAttributeObjectPostProcessor class.
- This is a special IObjectPostProcessor
- implementation that is [Required]-aware and
- actually provides the 'blow up if this required property has not been
- set' logic. It is very easy to configure; simply drop the following
- object definition into your Spring XML configuration.
+ RequiredAttributeObjectPostProcessor class. This is
+ a special IObjectPostProcessor implementation that
+ is [Required]-aware and actually provides the 'blow
+ up if this required property has not been set' logic. It is very easy
+ to configure; simply drop the following object definition into your
+ Spring XML configuration.
<object type="Spring.Objects.Factory.Attributes.RequiredAttributeObjectPostProcessor, Spring.Core"/>Finally, one can configure an instance of the
- RequiredAttributeObjectPostProcessor class to
- look for another Attribute type. This is great if
- you already have your own [Required]-style
- attribute. Simply plug it into the definition of a
- RequiredAttributeObjectPostProcessor and you
- are good to go. By way of an example, let's suppose you (or your
+ RequiredAttributeObjectPostProcessor class to look
+ for another Attribute type. This is great if you
+ already have your own [Required]-style attribute.
+ Simply plug it into the definition of a
+ RequiredAttributeObjectPostProcessor and you are
+ good to go. By way of an example, let's suppose you (or your
organization / team) have defined an attribute called [Mandatory]. You
can make a RequiredAttributeObjectPostProcessor
instance [Mandatory]-aware like so:
@@ -4270,8 +4275,8 @@ DEBUG - MovieApp Done.
Spring.Objects.Factory.Config.IObjectFactoryPostProcessor.
The semantics of this interface are similar to the
IObjectPostProcessor, with one major difference.
- IObjectFactoryPostProcessors operate on; that is
- to say, the Spring IoC container will allow
+ IObjectFactoryPostProcessors operate on; that is to
+ say, the Spring IoC container will allow
IObjectFactoryPostProcessors to read the
configuration metadata and potentially change it before the container
has actually instantiated any other objects. By implementing this
@@ -4287,32 +4292,31 @@ DEBUG - MovieApp Done.
You can configure multiple
IObjectFactoryPostProcessors if you wish. You can
control the order in which these
- IObjectFactoryPostProcessors execute by setting
- the 'Order' property (you can only set this property if the
+ IObjectFactoryPostProcessors execute by setting the
+ 'Order' property (you can only set this property if the
IObjectFactoryPostProcessors implements the
IOrdered interface; if you write your own
IObjectFactoryPostProcessors you should consider
- implementing the IOrdered interface too); consult
- the SDK docs for the IObjectFactoryPostProcessors
- and IOrdered interfaces for more details.
+ implementing the IOrdered interface too); consult the
+ SDK docs for the IObjectFactoryPostProcessors and
+ IOrdered interfaces for more details.
If you want to change the actual object instances (the objects
that are created from the configuration metadata), then you rather
- need to use a IObjectObjectPostProcessor
- (described above in the section entitled IObjectObjectPostProcessor (described
+ above in the section entitled Customizing objects with
IObjectPostProcessors.
- Also, IObjectFactoryPostProcessors are
- scoped per-container. This is only relevant if you are using container
+ Also, IObjectFactoryPostProcessors are scoped
+ per-container. This is only relevant if you are using container
hierarchies. If you define a
- IObjectFactoryPostProcessors in one container,
- it will only do its stuff on the object definitions in that container.
+ IObjectFactoryPostProcessors in one container, it
+ will only do its stuff on the object definitions in that container.
Object definitions in another container will not be post-processed by
- IObjectFactoryPostProcessors in another
- container, even if both containers are part of the same
- hierarchy.
+ IObjectFactoryPostProcessors in another container,
+ even if both containers are part of the same hierarchy.An object factory post-processor is executed manually (in the case
@@ -4326,9 +4330,9 @@ DEBUG - MovieApp Done.
objects transactionally or with any other kind of proxy, as described
later in this manual.
- In an IObjectFactory, the process of
- applying an IObjectFactoryPostProcessor is
- manual, and will be similar to this:
+ In an IObjectFactory, the process of applying
+ an IObjectFactoryPostProcessor is manual, and will be
+ similar to this:XmlObjectFactory factory = new XmlObjectFactory(new FileSystemResource("objects.xml"));
// create placeholderconfigurer to bring in some property
@@ -4339,32 +4343,32 @@ cfg.setLocation(new FileSystemResource("ado.properties"));
cfg.PostProcessObjectFactory(factory);This
+ id="objects-factory-autodetect-objectfactorypostprocessors">This
explicit registration step is not convenient, and this is one of the
reasons why the various IApplicationContext
implementations are preferred above plain
- IObjectFactory implementations in the vast
- majority of Spring-backed applications, especially when using
+ IObjectFactory implementations in the vast majority
+ of Spring-backed applications, especially when using
IObjectFactoryPostProcessors.
- An IApplicationContext will detect any
- objects which are deployed into it that implement the
+ An IApplicationContext will detect any objects
+ which are deployed into it that implement the
ObjectFactoryPostProcessor interface, and
automatically use them as object factory post-processors, at the
appropriate time. Nothing else needs to be done other than deploying
these post-processor in a similar fashion to any other object.
- Just as in the case of
- IObjectPostProcessors, you typically don't want
- to have IObjectFactoryPostProcessors marked as
- being lazily-initialized. If they are marked as such, then the Spring
+ Just as in the case of IObjectPostProcessors,
+ you typically don't want to have
+ IObjectFactoryPostProcessors marked as being
+ lazily-initialized. If they are marked as such, then the Spring
container will never instantiate them, and thus they won't get a
chance to apply their custom logic. If you are using the
'default-lazy-init' attribute on the declaration of your
<objects/> element, be sure to mark your various
- IObjectFactoryPostProcessor object definitions
- with 'lazy-init="false"'.
+ IObjectFactoryPostProcessor object definitions with
+ 'lazy-init="false"'.
@@ -4389,9 +4393,9 @@ cfg.PostProcessObjectFactory(factory);
implement the IObjectFactoryPostProcessor
interface. This means that as described here, applying a
PropertyPlaceholderConfigurer is much more
- convenient when using an IApplicationContext.
- For this reason, it is recommended that users wishing to use this or
- other object factory postprocessors use an
+ convenient when using an IApplicationContext. For
+ this reason, it is recommended that users wishing to use this or other
+ object factory postprocessors use an
IApplicationContext instead of an
IObjectFactory.
@@ -4401,7 +4405,8 @@ cfg.PostProcessObjectFactory(factory);
the main Spring.NET configuration file we use place holders, in the
NAnt style of ${variableName}, and obtain their values from
NameValueSections in the standard .NET application configuration file.
- The Spring.NET configuration file looks like: <configuration>
+ The Spring.NET configuration file looks like: <configuration>
<configSections>
<sectionGroup name="spring">
@@ -4463,16 +4468,16 @@ cfg.PostProcessObjectFactory(factory);${connection.string} match the key names used in
the two NameValueSectionHandlers DaoConfiguration
and DatabaseConfiguration. The
- PropertyPlaceholderConfigurer refers to these
- two sections via a comma delimited list of section names in the
+ PropertyPlaceholderConfigurer refers to these two
+ sections via a comma delimited list of section names in the
configSections property. If you are using section
groups, prefix the section group name, for example
myConfigSection/DaoConfiguraiton.
- The PropertyPlaceholderConfigurer class
- also supports retrieving name value pairs from other
- IResource locations. These can be specified
- using the Location and Locations
+ The PropertyPlaceholderConfigurer class also
+ supports retrieving name value pairs from other
+ IResource locations. These can be specified using
+ the Location and Locations
properties of the PropertyPlaceHolderConfigurer
class.
@@ -4529,17 +4534,17 @@ cfg.PostProcessObjectFactory(factory);
property placeholders. The use of environment variables is
controlled via the property
EnvironmentVariableMode. This property is an
- enumeration of the type
- EnvironmentVariablesMode and has three
- values, Never, Fallback, and Override. Fallback
- is the default value and will resolve a property placeholder if it
- was not already done so via a value from a resource location.
- Override will apply environment variables before
- applying values defined from a resource location.
- Never will, quite appropriately, disable
- environment variable substitution. An example of how the
- PropertyPlaceholderConfigurer XML is modified
- to enable override usage is shown below <object name="appConfigPropertyHolder"
+ enumeration of the type EnvironmentVariablesMode
+ and has three values, Never, Fallback, and Override.
+ Fallback is the default value and will resolve a
+ property placeholder if it was not already done so via a value from
+ a resource location. Override will apply
+ environment variables before applying values defined from a resource
+ location. Never will, quite appropriately,
+ disable environment variable substitution. An example of how the
+ PropertyPlaceholderConfigurer XML is modified to
+ enable override usage is shown below <object name="appConfigPropertyHolder"
type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="configSections" value="DaoConfiguration,DatabaseConfiguration"/>
<property name="EnvironmentVariableMode" value="Override"/>
@@ -4554,8 +4559,8 @@ cfg.PostProcessObjectFactory(factory);The PropertyOverrideConfigurer, another
object factory post-processor, is similar to the
- PropertyPlaceholderConfigurer, but in contrast
- to the latter, the original definitions can have default values or no
+ PropertyPlaceholderConfigurer, but in contrast to
+ the latter, the original definitions can have default values or no
values at all for object properties. If an overriding configuration
file does not have an entry for a certain object property, the default
context definition is used.
@@ -4564,13 +4569,13 @@ cfg.PostProcessObjectFactory(factory);not aware of being overridden, so it is not
immediately obvious when looking at the XML definition file that the
override configurer is being used. In case that there are multiple
- PropertyOverrideConfigurer instances that
- define different values for the same object property, the last one
- will win (due to the overriding mechanism).
+ PropertyOverrideConfigurer instances that define
+ different values for the same object property, the last one will win
+ (due to the overriding mechanism).
The example usage is similar to when using
- PropertyPlaceHolderConfigurer except that the
- key name refers to the name given to the object in the Spring.NET
+ PropertyPlaceHolderConfigurer except that the key
+ name refers to the name given to the object in the Spring.NET
configuration file and is suffixed via 'dot' notation with the name of
the property For example, if the application configuration file is
<configuration>
@@ -4671,11 +4676,10 @@ cfg.PostProcessObjectFactory(factory);VariableSource to a single
IVariableSource instance or the list property
VariableSources to a list of
- IVariableSource instances. In the case of the
- same property defined in multiple
- IVariableSource implementations, the first one
- in the list that contains the property value will be used.
- <object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
+ IVariableSource instances. In the case of the same
+ property defined in multiple IVariableSource
+ implementations, the first one in the list that contains the property
+ value will be used. <object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
<property name="VariableSources">
<list>
<object type="Spring.Objects.Factory.Config.ConfigSectionVariableSource, Spring.Core">
@@ -4744,16 +4748,16 @@ cfg.PostProcessObjectFactory(factory);
places within the Spring Framework. Some examples of its use is
described in for the
PropertyRetrievingFactoryObject and
- FieldRetrievingFactoryObject. An additional use
- of creating an custom IFactoryObject implementation is to retrieve an
+ FieldRetrievingFactoryObject. An additional use of
+ creating an custom IFactoryObject implementation is to retrieve an
object from an embedded resource file and use it to set another objects
dependency. An example of this is provided here.
Finally, there is sometimes a need to ask a container for an
- actual IFactoryObject instance itself, not the
- object it produces. This may be achieved by prepending the object id
- with '&' (sans quotes) when calling the
+ actual IFactoryObject instance itself, not the object
+ it produces. This may be achieved by prepending the object id with
+ '&' (sans quotes) when calling the
GetObject method of the
IObjectFactory (including
IApplicationContext). So for a given
@@ -4769,9 +4773,8 @@ cfg.PostProcessObjectFactory(factory);The
Spring.Objects.Factory.IConfigurableFactoryObject
- interface inherits from IFactoryObject
- interface and adds the following property.
+ interface inherits from IFactoryObject interface
+ and adds the following property. IObjectDefinition ProductTemplate :
Gets the template object definition that should be used to
@@ -4780,8 +4783,8 @@ cfg.PostProcessObjectFactory(factory);
- IConfigurableFactoryObject implementions
- you already have examples of in are
+ IConfigurableFactoryObject implementions you
+ already have examples of in are
WebServiceProxyFactory.
@@ -4809,8 +4812,8 @@ cfg.PostProcessObjectFactory(factory);
IApplicationContext interface, located in the
Spring.Context namespace. Deriving from the
IObjectFactory interface, it provides all the
- functionality of the IObjectFactory. To be able to
- work in a more framework-oriented fashion, using layering and hierarchical
+ functionality of the IObjectFactory. To be able to work
+ in a more framework-oriented fashion, using layering and hierarchical
contexts, the Spring.Context namespace also provides
the following functionality
@@ -4843,28 +4846,27 @@ cfg.PostProcessObjectFactory(factory);
IObjectFactory or IApplicationContext?
- Short version: use an
- IApplicationContext unless
- you have a really good reason for not doing so. For those of you that
- are looking for slightly more depth as to the 'but why' of the above
- recommendation, keep reading.
+ Short version: use an
+ IApplicationContext
+ unless you have a really good reason for not doing so. For
+ those of you that are looking for slightly more depth as to the 'but
+ why' of the above recommendation, keep reading.As the IApplicationContext includes all the
functionality the object factory via its inheritance of the
- IObjectFactory interface, it is generally
- recommended to be used over the IObjectFactory
- except for a few limited situations where memory consumption might be
- critical. This may become more important if the .NET Compact Framework
- is supported. The history of IObjectFactory comes
- from the Spring Java framework, where the use of Spring in Applets was a
- concern to reduce memory consumption. However, for most 'typical'
- enterprise applications and systems, the
- IApplicationContext is what you will want to use.
- Spring generally makes heavy use of the
+ IObjectFactory interface, it is generally recommended
+ to be used over the IObjectFactory except for a few
+ limited situations where memory consumption might be critical. This may
+ become more important if the .NET Compact Framework is supported. The
+ history of IObjectFactory comes from the Spring Java
+ framework, where the use of Spring in Applets was a concern to reduce
+ memory consumption. However, for most 'typical' enterprise applications
+ and systems, the IApplicationContext is what you will
+ want to use. Spring generally makes heavy use of the
IObjectPostProcessor extension point (to effect
proxying and suchlike), and if you are using just a plain
- IObjectFactory then a fair amount of support such
- as transactions and AOP will not take effect (at least not without some
+ IObjectFactory then a fair amount of support such as
+ transactions and AOP will not take effect (at least not without some
extra steps on your part), which could be confusing because nothing will
actually be wrong with the configuration.
@@ -4873,8 +4875,8 @@ cfg.PostProcessObjectFactory(factory);
IApplicationContext interfaces (and attendant
implementations). The following sections describe functionality that
IApplicationContext adds to the basic
- IObjectFactory capabilities in a lot more depth
- than the said feature matrix.)
+ IObjectFactory capabilities in a lot more depth than
+ the said feature matrix.)