开发者

Adding reference which is needed in Config file

开发者 https://www.devze.com 2023-04-01 14:54 出处:网络
I have two different projects \'A\' and \'B\'.A needs reference of B.I used spring.net setter property injection.I configured it in开发者_Go百科 config file.

I have two different projects 'A' and 'B'.A needs reference of B.I used spring.net setter property injection.I configured it in开发者_Go百科 config file.

I have one more new console application where i added only 'A's reference and im getting the 'A's instance through XmlApplicationConext(path).but after running it im getting object creation exception.

Do i need to add 'B's refrence also in console application.if yes then what is the use of using spring .net config file.

Does Spring.Net internally automatically will load the dlls required.


Spring will automatically load the required dll's. As far as I know, it will look for the dll's to load in the same order as any other .NET application.

If you configure the console application to use classes from project B, then B.dll (the output dll from project B) has to be available to the console application at runtime only. You do not have to add a reference to project B to achieve this; you could also copy the B.dll file to the output directory.

I'm not sure what you mean by "the Spring.net config file", but be aware that config files are not automatically loaded, you have to specify them explicitly. You can import another configuration file in you configuration file, see the docs for a how-to:

<objects xmlns="http://www.springframework.net">

  <import resource="file:///services.xml"/>
  <import resource="assembly://ProjectB/MyDataAccess/data-access.xml"/>

  <object id="object1" type="..."/>
  <object id="object2" type="..."/>

</objects>
0

精彩评论

暂无评论...
验证码 换一张
取 消