How do I configure a NULL object in Spring.Net
In the particular project in which I'm working it is appropriate to to have a null log service object. Since this is configured in Spring.Net How do I configure my spring.net object to be null. This开发者_如何学JAVA is what I'd like to do. Is it possible?
<objects xmlns="http://www.springframework.net">
<!-- Messages -->
<object id ="LogService">
<null />
</object>
You can inject a null object :
<object id="MyObject">
<property name="LogServer">
<null/>
</property>
</object>
To create a null object, you have to implement IFactoryObject and return null. http://www.springframework.net/doc-latest/reference/html/objects.html#objects-factory-extension
- Bruno
精彩评论