Spring.net 在mvc中的用法

本文详细介绍了如何在ASP.NET MVC项目中配置Spring.NET框架。包括引入必要的DLL文件、定义全局应用程序类、设置web.config文件中的Spring.NET配置部分,并通过controllers.xml文件实现依赖注入。

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

1.      引dll文件:Common.Loggong ,Spring.Core,Spring.Web ,Spring.Web.Mvc3

2.      Global中public classMvcApplication : Spring.Web.Mvc.SpringMvcApplication

3.      Type=”类全名称,程序集”

web.config文件中

<configuration>
  <configSections>
	  <!--Spring.net的相关配置-->
	  <sectionGroup name="spring">
		  <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
	  </sectionGroup>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
	<!--Spring.net下的context相关配置-->
	<spring>
		<context>
			<resource uri="file://~/Config/controllers.xml"/>
		</context>


在controllers.xml文件中
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
	<!--UserInfoController--> 
	<object  type="SoftWareVoice.OA.Controllers.UserInfoController,SoftWareVoice.OA" singleton="false" >
		<property name="UserInfoBLL" ref="UserInfoBLL" />
	</object>
	<object name="UserInfoBLL" type="SoftWareVoice.OA.BLL.UserInfoBLL,SoftWareVoice.OA.BLL" singleton="false" ></object>
</objects>





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值