当前位置:网站首页>BeanPostProcessor 和 BeanFactoryPostProcessor
BeanPostProcessor 和 BeanFactoryPostProcessor
2022-06-29 06:38:00 【wending-Y】
BeanFactoryPostProcessor
对读取到的所有bean可以进行修改,在这之前已经拿到了所有的Bean定义,不管是xml还是注解
@Component
public class BeanFactoryPostProcessorImp implements BeanFactoryPostProcessor {
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
System.out.println("factory");
System.out.println(beanFactory.getBeanDefinition("simple").getBeanClassName());
}
}
BeanPostProcessor
initializeBean 在这个方法里执行后置处理器
在bean初始化前,初始化后可以进行处理
@Component
public class BeanPostProcessorImp implements BeanPostProcessor {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
System.out.println("初始化前");
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
System.out.println("初始化后");
return bean;
}
}
结语
BeanFactoryPostProcessor 顺序在前
BeanPostProcessor 顺序在后
边栏推荐
- Message queue batch processing refund order through queue
- Qt 容器类
- 把多个ROC曲线画在一张图上
- Vite quick start
- Differences between JSON objects and JSON strings
- Solve the problem that NPM does not have permission
- Introduction to Ceres Quartet
- Introduction to NoSQL database
- json tobean
- Redis (V) of NoSQL database: redis_ Jedis_ test
猜你喜欢

Qt 串口编程
![[QNX Hypervisor 2.2用户手册]6.2.1 Guest之间通信](/img/3d/6a0cde206a09a7ef03038fb99cf532.png)
[QNX Hypervisor 2.2用户手册]6.2.1 Guest之间通信

利用IPv6实现公网访问远程桌面

Testing grpc service with grpcui

Introduction to Ceres Quartet

Utilisation d'IPv6 pour réaliser l'accès public au bureau distant

Uniapp obtains the date implementation of the beginning and end of the previous month and the next month

大型化工企业数字化转型建议

CI工具Jenkins之二:搭建一个简单的CI项目

关于数据库,你应该知道的事情
随机推荐
JVM系列之对象深度探秘
Message queue batch processing refund order through queue
What is the difference between software engineer and software development? What is the difference between software engineer and software developer?
NoSQL數據庫之Redis(五):Redis_Jedis_測試
Daily question 1 - force deduction - there are three consecutive arrays of odd numbers
And check the collection hello
Exploring the depth of objects in JVM series
[translation] [Chapter II ①] mindshare PCI Express technology 3.0
Idea integrated code cloud
Livedata source code appreciation - basic use
QT serial port programming
通过keyup监听textarea输入更改按钮样式
更改主机名的方法(永久)
Redis (4) of NoSQL database: redis new data type
Relevance - correlation analysis
Qt STL类型迭代器
shell条件判断详解
Database - Synonyms
Error: GPG check FAILED Once install MySQL
Markdown 技能树(9):表格