惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - DongD

今天在ASP.NET上在写一个读取EXCEL文件内容的功能,但是IE8貌似把文件路径给屏蔽了,在IE6下面读取正常!有啥好办法? 刚看了一点Spring .NET, 从第一个例子MovieFinder说起 RegularExpressionValidator控件中正则表达式用法[转] 一个计算周次和本周时间范围的代码(c#) ASP.NET 安全认证(二)【转】 ASP.NET 的安全认证 - DongD - 博客园 Host and Workflow: Two Worlds to Communicate: Part III Host and Workflow: Two Worlds to Communicate - Part II Host and Workflow: Two Worlds to Communicate: Part I .NET2.0正则表达式【转】 解决Active Directory密码不满足密码策略的要求 Gridview控件中字符串的截取【转】 asp.net(c#)常用正则表达式实例 C#中的delegate和event 【转】 Asp.net &C#开发中的一些注意事项及小技巧【转】 C# 事件机制【转】 asp.net中为TextBox Web服务器控件添加OnClick事件【转】 gridview在绑定显示的各种格式 跳楼有感【转载】
刚看了一点Spring .NET, 从第一个例子MovieFinder说起(2)
DongD · 2012-06-09 · via 博客园 - DongD

作者接下来定义了另外一种ImovieFinder接口的实现

<object name="AnotherMovieFinder"
      type
="Spring.Examples.MovieFinder.ColonDelimitedMovieFinder, Spring.Examples.MovieFinder">

<constructor-arg index="0" value="movies.txt"/> 

  </object>  

ColonDelimitedMovieFinder的没有默认构造函数,需要提供一个参数,constructor-arg标签就是指明参数用的

然后替换MyMovieLister 的注入,其实就是得到ImovieFinder接口另外一个实现,直接在config文件中改

<object name="MyMovieLister"
    type
="Spring.Examples.MovieFinder.MovieLister, Spring.Examples.MovieFinder">
      <!-- lets use the colon delimited implementation instead -->
      <property name="movieFinder" ref="AnotherMovieFinder"/>
  </object>
  <object name="MyMovieFinder"
      type
="Spring.Examples.MovieFinder.SimpleMovieFinder, Spring.Examples.MovieFinder"/>
  </object>
  <object name="AnotherMovieFinder"
      type
="Spring.Examples.MovieFinder.ColonDelimitedMovieFinder, Spring.Examples.MovieFinder">
      <constructor-arg index="0" value="movies.txt"/>

</object>  

这样就可以得到 ImovieFinder接口的ColonDelimitedMovieFinder实现。

 不用重新编译!这就是Spring IOC的好处?

 的确:如果用代码写的话要这样:

开始用 SimpleMovieFinder实现ImovieFinder接口

SimpleMovieFinder simple = new SimpleMovieFinder ();

 MovieLister movieLister = new movieLister (simple );

如果要改用 ColonDelimitedMovieFinder得话要改代码:

 ColonDelimitedMovieFinder colon= new ColonDelimitedMovieFinder ("movie.txt");

 MovieLister movieLister = new movieLister (colon );

通过改config文件 ,就不用改代码了!这就是Ioc的好处啊!!???