-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathsprin4.0-api.java
More file actions
101 lines (83 loc) · 2.57 KB
/
Copy pathsprin4.0-api.java
File metadata and controls
101 lines (83 loc) · 2.57 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-----------------------
Index |
-----------------------
# IOC容器
ApplicationContext
|-ConfigurableApplicationContext
* 扩展于ApplicationContext,新增两个主要的方法
* 这哥们儿还是一个接口,只是更强大.
* refresh(); //启动或者刷新上下文
* close(); //关闭上下文
|-ClassPathXmlApplicationContext
* 从类路径下加载配置文件
* 可以同时加载多个配置文件
* new ClassPathXmlApplicationContext("beans1.xml","beans2.xml");
|-FileSystemXmlApplicationContext
* 从文件系统加载配置文件
|-WebApplicationContext
* 是专门为WEB应用而准备的,它允许从相对于WEB根目录的路径中完成初始化工作
# Bean生命周期相关
ApplicationContextAware
# Bean生命周期接口,实现该接口可以获取ApplicationContext
BeanNameAware
# Bean生命周期接口,会把当前Bean的Bean名称通过抽象方法注入进来
InitializingBean
# Bean生命周期接口,实现该接口,会在属性注入完毕后调用抽象方法
BeanPostProcessor
# Bean生命周期接口,实现该接口,会在Bean初始化的'前后'调用对应的抽象方法
|-Object postProcessBeforeInitialization(Object var1, String var2) throws BeansException;
|-Object postProcessAfterInitialization(Object var1, String var2) throws BeansException;
DisposableBean
# Bean生命周期接口,实现该接口,会在IOC关闭的时候调用抽象方法
# 静态工具类
Environment
# 环境变量
Resource
# 资源加载器
|-ClassPathResource
ClassUtils
# 操作Class的工具类
StringUtils
# 操作String的工具类
ReflectionUtils
#反射工具类
CollectionUtils
# 操作集合的工具类
-----------------------
ApplicationContextAware |
-----------------------
-----------------------
Environment |
-----------------------
# org.springframework.core.env.Environment
# 可以在任何地方注入,里面有当前环境的一些变量,包含了外部配置文件的变量
environment.getProperty("bbs.dbPassowrd");
---------------------
Resource |
---------------------
# spring 的东西,是一个接口
# org.springframework.core.io.Resource
# 子类
ClassPathResource
# classpath下的资源加载器
Resource resource = new ClassPathResource("/xxx.properties");
Properties props = PropertiesLoaderUtils.loadProperties(resource);
* 把加载到的资源,映射进 Properties
---------------------
ClassUtils |
---------------------
---------------------
StringUtils |
---------------------
# 静态方法
String trimAllWhitespace(String str);
* 去除字符串中的所有空格
---------------------
ReflectionUtils |
---------------------
# 静态方法
Field ReflectionUtils.findField(Clazz class, String fieldName);
* 反射获取到指定 Class 的指定字段,可以获取到私有的字段
---------------------
CollectionUtils |
---------------------