-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeanPostProcessor.js
More file actions
34 lines (33 loc) · 1.15 KB
/
BeanPostProcessor.js
File metadata and controls
34 lines (33 loc) · 1.15 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
/**
* BeanPostProcessor — hook into the ApplicationContext bean lifecycle.
*
* Implement postProcessBeforeInitialization and/or postProcessAfterInitialization
* to intercept bean creation. Register as a context component like any other bean.
*
* ApplicationContext detects BeanPostProcessor instances automatically and calls
* them for every singleton during the lifecycle.
*
* The default implementations return the instance unchanged.
*/
export default class BeanPostProcessor {
/**
* Called after dependency injection but before init() for each singleton.
*
* @param {Object} instance — the bean instance
* @param {string} name — the bean name in the context
* @returns {Object} the (possibly modified or replaced) bean instance
*/
postProcessBeforeInitialization(instance, name) {
return instance;
}
/**
* Called after init() for each singleton.
*
* @param {Object} instance — the bean instance
* @param {string} name — the bean name in the context
* @returns {Object} the (possibly modified or replaced) bean instance
*/
postProcessAfterInitialization(instance, name) {
return instance;
}
}