首页 > 代码库 > Spring.net init-method destroy-method

Spring.net init-method destroy-method

<object id="exampleInitObject" type="Examples.ExampleObject" init-method="init" destroy-method="cleanup" singleton="false"/>[C#]public class ExampleObject{
public void cleanup()
{
   // do some destruction work (such as closing any open connection (s))
}
public void Init() { // do some initialization work }}这样spring创建实例的时候,会自己去调用Init进行一些初始化的工作

 

Spring.net init-method destroy-method