spring spring.core IOC xml 注册
public class SpringUtils
{
static IApplicationContext context;
public static T GetObject<T>(string name) where T : class
{
if(context == null)
{
context = new XmlApplicationContext("file://objects.xml");
}
return context.GetObject<T>(name);
}
}
<?xml version="1.0" encoding="utf-8" ?> <objects xmlns="http://www.springframework.net"> <object id="BusinessSession" type="Game.Platform.Service.BusinessSession,Game.Platform.Service" singleton="false"/> <object id="DataSessionFactory" type="Game.Platform.Repository.DataSessionFactory,Game.Platform.Repository" singleton="false"/> </objects>
讓眾人的薪枝構起這團熱情的火焰