ASP.NET MVC中使用Spring.Net实现IOC和DI

本文详细介绍了如何在一个ASP.NET MVC项目中集成Spring.NET框架,包括必要的DLL文件拷贝与引用、配置文件的设置及Web.Config的调整等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一步:新建一个ASP.NET MVC项目


第二步:拷贝

Spring.Core.dll

Spring.Core.pdb

Spring.Core.xml

Spring.Web.dll

Spring.Web.Extensions.dll

Spring.Web.Extensions.pdb

Spring.Web.Extensions.xml

Spring.Web.Mvc4.dll

Spring.Web.Mvc4.pdb

Spring.Web.Mvc4.xml

Common.Logging.dll


第三步:引用

Common.Logging.dll

Spring.Core.dll

Spring.Web.dll

Spring.Web.Extensions.dll

Spring.Web.Mvc4.dll


第四步:拷贝Spring.Mvc4QuickStart下的Config文件夹到项目根目录


第五步:配置Config

  <object type="Spring.Mvc4QuickStart.Controllers.HomeController, Spring.Mvc4QuickStart" singleton="false" >
    <property name="Message" value="Welcome to ASP.NET MVC4 powered by Spring.NET!" />
  </object>


第六步:将Service的对象提取至service.xml(注意属性中将其拷贝到根目录并且拷贝方式为内容)


第七步:配置Web.Config 制定service.xml的路径


第八步:在Global.asax文件中将MvcApplication 继承自 SpringMvcApplication

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值