@postconstruct作用
时间: 2023-09-02 09:10:58 浏览: 140
SpringBoot @PostConstruct原理用法解析
回答: @PostConstruct注解的作用是在依赖注入完成后,执行一些初始化操作的方法。这个注解标注的方法会在对象创建并完成依赖注入后自动调用。常见的应用场景是在初始化缓存或执行一些需要依赖注入完成后才能执行的操作。@PostConstruct注解的方法执行顺序是在依赖注入完成后立即执行。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [SpringBoot中@PostConstruct注解作用](https://blog.csdn.net/qq_45335399/article/details/126885872)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [最快讲一个spring注解:@PostConstruct](https://blog.csdn.net/a24b86/article/details/105146855)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [springboot的@PostConstruct注解](https://blog.csdn.net/u011066470/article/details/122844165)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文