<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进行一些初始化的工作
时间: 2024-11-05 16:26:19