首页 / 网页编程 / ASP.NET / Asp.net MVC Beta整合Spring.Net
Asp.net MVC Beta整合Spring.Net2011-01-27 博客园 kilxyASP.Net MVC已经是Beta版了,相信不久就会有正式版本发布。关于Asp.Net MVC的文章已经非常多,大家可以在博客园里面搜索。具体关于Asp.Net的介绍我在这里就不多说了。我这里主要介绍Asp.Net MVC整合Spring.Net的一个小小的实践。在Asp.Net MVC框架下,所有的Controller都是由系统自动Routing到具体的Controller类中,那么怎么能够由Spring.Net进行创建呢?第一步:下载Spring.Net我用的Spring.Net的版本是1.2.0,大家可以从http://www.springframework.net/ 去下载。第二步:引入库文件在你的MVC项目中引入Spring.net的库文件,具体如下:antlr.runtime.dllCastle.Core.dllCastle.DynamicProxy2.dllCommon.Logging.dllIesi.Collections.dlllog4net.dllSpring.Aop.dllSpring.Core.dllSpring.Web.dllSpring.Web.Extensions.dll第三步:配置Spring.net要在Web项目中加载Srping的配置,首先要修改Web.config配置文件:在configSections节中增加如下内容:Code<!-- Spring Configration -->
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
</sectionGroup>在configSections节之后增加如下:Code<spring>
<context>
<resource uri="file://~/Spring.config"/>
</context>
</spring>其中file://~/Spring.config是Spring.net的加载Object的配置文件,当然可以有多个配置文件。