Repository navigation
Expand file tree
/
Copy pathPerson.java
More file actions
71 lines (57 loc) · 1.8 KB
/
Copy pathPerson.java
File metadata and controls
71 lines (57 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.chen.spring.bean;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* @author : chen weijie
* @Date: 2020-06-08 17:37
*/
public class Person implements BeanNameAware, BeanFactoryAware, ApplicationContextAware, InitializingBean, DisposableBean {
private String name;
public Person() {
System.out.println("Person类构造方法");
}
@Override
public void setBeanName(String s) {
// TODO Auto-generated method stub
System.out.println("setBeanName被调用,beanName:" + s);
}
/**
* 自定义的初始化函数
*/
public void myInit() {
System.out.println("myInit被调用");
}
/**
* 自定义的销毁方法
*/
public void myDestroy() {
System.out.println("myDestroy被调用");
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
System.out.println("setBeanFactory被调用,beanFactory");
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
System.out.println("setApplicationContext被调用");
}
@Override
public void afterPropertiesSet() throws Exception {
// TODO Auto-generated method stub
System.out.println("afterPropertiesSet被调用");
}
@Override
public void destroy() throws Exception {
// TODO Auto-generated method stub
System.out.println("destory被调用");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
System.out.println("set方法被调用");
}
}