webapi spring.net无法注入
使用mvc4生成工程,引入spring.net 及配置注入XML
在工程中增加了 areas 作为 webapi
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database">
<object id="IndexController" type="Test.WebUI.Controllers.IndexController, Test.WebUI" singleton="false">
<property name="MyTestService" ref="bllMyTest"></property>
</object>
<object id="HomeController" type="Test.WebUI.Areas.MyArea.Controllers.HomeController, Test.WebUI" singleton="false">
<property name="MyTestService" ref="bllMyTest"></property>
</object>
</objects>
为什么在页面 IndexController 的控制器中可以注入 bllMyTest ,即在 webapi 的 HomeController中无法注入 bllMyTest,显示属性为null
难道注入是不是按 type中的类来注入的? 需要把bllMyTest注入到areas的 webapi 中。