码迷,mamicode.com
首页 > 编程语言 > 详细

spring bean的生命周期

时间:2017-01-03 19:00:23      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:ati   package   cto   imp   sse   row   ica   ext   except   

package com.huawei.entity;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class Test implements BeanNameAware,BeanFactoryAware,InitializingBean,ApplicationContextAware ,DisposableBean{

public Test(){
System.out.println("test初始化");
}

public void setBeanName(String arg0) {
System.out.println("Test.setBeanName()");
}

public void setBeanFactory(BeanFactory arg0) throws BeansException {
System.out.println("Test.setBeanFactory()");
}

public void afterPropertiesSet() throws Exception {
System.out.println("Test.afterPropertiesSet()");
}

public void setApplicationContext(ApplicationContext arg0) throws BeansException {
System.out.println("Test.setApplicationContext()");
}

public void destroy() throws Exception {
System.out.println("Test.destroy()");
}
public void init(){
System.out.println("Test.init()");
}
}

spring bean的生命周期

标签:ati   package   cto   imp   sse   row   ica   ext   except   

原文地址:http://www.cnblogs.com/javaweb2/p/6245712.html

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