码迷,mamicode.com
首页 > 其他好文 > 详细

Bean生命周期配置

时间:2020-05-05 23:35:40      阅读:55      评论:0      收藏:0      [点我收藏+]

标签:use   package   sys   初始   col   system   void   pack   color   

init-method:指定类中的初始化方法名称

destroy-method:指定类中销毁方法名称

<bean id="userDao" class="ioc1.it.dao.userDaoImpl" init-method="init" destroy-method="destroy"></bean>

 

 

package ioc1.it.dao;

public class userDaoImpl implements userDao {
    public userDaoImpl() {
        System.out.println("无参");
    }
    public void init(){
        System.out.println("init");
    }
    public void destroy(){
        System.out.println("destroy");
    }
}

 

Bean生命周期配置

标签:use   package   sys   初始   col   system   void   pack   color   

原文地址:https://www.cnblogs.com/jiangzishun/p/12833506.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!