I have a couple questions about @PostConstruct in Spring.
I will be grateful for the answers)
Yes, Spring calls @PostConstruct
marked methods the object before it gets available to the application (Before injection). This is a part of bean creation.
No. Spring creates an internal structure called "bean definition" during the application context initialization. Its a meta data about the bean. If the bean has "post-construct" method spring knows this and calls the relevant method during the bean creation.
@PostConstruct is thread safe. It only runs once after the bean created in the whole lifecycle of the bean.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.