Tommy_Shen
11-16-2006, 02:17 AM
hi, all
same as the title. I think I configurate the web.config correctly, but Spring doesn't inject object to my aspx pages. I saw that Spring WebApplicationContext had loaded my aspx page object in logfile, and I could get the object if I code in my aspx.cs source file like :
IApplicationContext ctx = ContextRegistry.GetContext();
memberDao = ctx["MemberDAO"] as IMemberDAO;
but miss DI, why?
configuration snippet:
Web.Config
...
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
...
<context>
<resource uri="assembly://DDA.GA.Business/DDA.GA.Business.Context/applicationContext-Business.xml"/>
<resource uri="assembly://DDA.GA.Business/DDA.GA.Business.Context/applicationContext-Db.xml"/>
<resource uri="~/Context/applicationContext-Web.xml"/>
</context>
applicationContext-Web.xml:
<objects xmlns="http://www.springframework.net" default-autowire="byName">
<object id="DefaultPage" type="~/Default.aspx"/>
</objects>
same as the title. I think I configurate the web.config correctly, but Spring doesn't inject object to my aspx pages. I saw that Spring WebApplicationContext had loaded my aspx page object in logfile, and I could get the object if I code in my aspx.cs source file like :
IApplicationContext ctx = ContextRegistry.GetContext();
memberDao = ctx["MemberDAO"] as IMemberDAO;
but miss DI, why?
configuration snippet:
Web.Config
...
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
...
<context>
<resource uri="assembly://DDA.GA.Business/DDA.GA.Business.Context/applicationContext-Business.xml"/>
<resource uri="assembly://DDA.GA.Business/DDA.GA.Business.Context/applicationContext-Db.xml"/>
<resource uri="~/Context/applicationContext-Web.xml"/>
</context>
applicationContext-Web.xml:
<objects xmlns="http://www.springframework.net" default-autowire="byName">
<object id="DefaultPage" type="~/Default.aspx"/>
</objects>