I am learning Spring.Net, I created a class MyApplication and a library class MyLib with all the spring configuration files that MyApplication needs.
I retrieve the metadata using:
IApplicationContext ctx = new XmlApplicationContext("assembly...");
I have three different xml files, one (springconfiguration.xml) imports the two other. At the beginning of my tries, my spring configuration files were at the root level of MyLib. Everything worked fine.
----- MyLib
-- Properties
-- References
-- commonspring.xml
-- buttonspring.xml
-- springconfiguration.xml
Then I created some folders in MyLib to store my xml files and it fails if I use subfolders:
the following works:
----- MyLib
--Properties
--References
--Common
--commonspring.xml
--Gui
--buttonspring.xml
--Configuration
--springconfiguration.xml
my springconfiguration.xml file is then:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<import resource="Common/commonspring.xml"/>
<import resource="Gui/buttonspring.xml"/>
</objects>
and I retrieve the context with:
IApplicationContext ctx = new XmlApplicationContext("assembly://MyLib/MyLib/Configuration.springconfiguration.xml");
but if I use subfolders then it fails:
----- MyLib
--Properties
--References
--Common
--commonspring.xml
--Gui
--SpecialButton
--buttonspring.xml
--Configuration
--springconfiguration.xml
my springconfiguration.xml file is then:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<import resource="Common/commonspring.xml"/>
<import resource="Gui/SpecialButton/buttonspring.xml"/>
</objects>
and I retrieve the context with:
IApplicationContext ctx = new XmlApplicationContext("assembly://MyLib/MyLib/Configuration.springconfiguration.xml");
The error is:
{"Error registering object defined in 'assembly [MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [MyLib.Configuration.springconfiguration.xml] at line 5' : Invalid relative resource location 'Gui/SpecialButton/buttonspring.xml' to import object definitions from.\r\n<import resource=\"Gui/SpecialButton/buttonspring.xml\" xmlns=\"http://www.springframework.net\" />"}
I tried several syntaxes, I looked in the documentation and did not find any solution. Has someone an idee of where is the problem?
Update
ok I found by myself: the correct syntaxe is:
<import resource="Gui.SpecialButton.buttonspring.xml"/>
then no errors are raised anymore and everything work fine.