spring.net依赖注入到Web页面
2009-07-15 08:49
477 查看
1. 添加Spring的SectionGroup
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
2. 添加HttpHandler配置
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
3. 添加HttpModule配置(如果不添加的话,会有异常)
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
4. 最后配置如何依赖注入
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object type="Default.aspx">
<property name="Service" ref="myService"/>
</object>
<object id="myService" type="Services.MyService, Services">
</object>
</objects>
</spring>
这是一个关于spring.net学习的一个网站:
http://www.springframework.net/index.html
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
2. 添加HttpHandler配置
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
3. 添加HttpModule配置(如果不添加的话,会有异常)
<add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
4. 最后配置如何依赖注入
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object type="Default.aspx">
<property name="Service" ref="myService"/>
</object>
<object id="myService" type="Services.MyService, Services">
</object>
</objects>
</spring>
这是一个关于spring.net学习的一个网站:
http://www.springframework.net/index.html
相关文章推荐
- 使用Spring.Net对Web页面进行依赖注入
- 使用Spring.Net对Web页面进行依赖注入
- Unity&WebForm(1): 自定义IHttpHandlerFactory使用Unity对ASP.NET Webform页面进行依赖注入
- Spring.Net-DI依赖注入和Ioc控制反转
- Spring.NET依赖注入框架学习--入门
- Spring.NET依赖注入框架学习--简介
- ASP.NET_MVC使用Spring.Net.MVC依赖注入学习笔记
- SPRING.NET 1.3.2 学习5--依赖注入
- spring.net (3)依赖注入基础2
- .NET 使用spring.net实现依赖注入
- spring.net学习笔记1--依赖对象注入
- [转]什么是依赖注入--Spring.net的核心机制依赖注入简介
- ASP.NET Web Application 中使用 Unity 依赖注入容器
- Spring.NET教程(六)——依赖对象的注入(基础篇)
- Spring.net依赖注入及环境配置
- Spring.Net依赖注入(属性注入)
- Spring IoC 依赖注入 BeanFactory ApplicationContext WebApplicationContext
- spring.net (3)依赖注入基础
- Spring.NET依赖注入框架学习-- 泛型对象的创建和使用
- Spring.NET依赖注入 - 制作可替换的算法