Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring .Net Setter injection
    primarykey
    data
    text
    <p>I need to inject either through setter or constructor level a interface with spring .Net. I don't want to write spring.Net (use of ApplicationContext) code but accomplish it purely through XML. It seems like its not possible and my thinking is to use the static factory pattern. The problem comes when I create a instance of the object the property I set is null, so I'm not sure how to fire the injection without using the applicationContext methods.</p> <p>My XML code.</p> <pre class="lang-xml prettyprint-override"><code>&lt;spring&gt; &lt;context&gt; &lt;resource uri="config://spring/objects"/&gt; &lt;/context&gt; &lt;objects xmlns="http://www.springframework.net"&gt; &lt;object id="foo" type="SpringIoC.Test.GlobalVariables, SpringIoC.Test"&gt; &lt;constructor-arg ref="anotherExampleObject"/&gt;&gt; &lt;/object&gt; &lt;object id="anotherExampleObject" type="SpringIoC.Implementor.HalloWorld, SpringIoC.Implementor"/&gt; &lt;/objects&gt; &lt;/spring&gt; </code></pre> <p>My C# code:</p> <pre><code>public class GlobalVariables { public GlobalVariables(IHalloWorld hallo) { halloWorld = halloWorld; } private IHalloWorld halloWorld; public IHalloWorld Hallo { set { halloWorld = value; } } public IHalloWorld getHallo { get { return halloWorld; } } } </code></pre> <p>The above XML are correct but how do i fire the injection without the use of <code>applicationContext</code>?</p> <p>How do I get my hands on a instance of <code>GlobalVariables</code> without creating it through spring.Net.</p> <p>The above is little confusing so please ask question if I'm not clear.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload