Dependency Injection:
Literally, you know, to inject object B into object A, you first have to generate object B and object A to perform the injection.
So, if there is a member variable B in a Class A that is @autowired annotated, then @autowired injection occurs after the construction method of a has finished executing.
If you want to do some initialization when you build the object,
It happens that these classes are initialized and dependent on other class injections, and cannot be implemented in constructors.
To do this, you can use the @postconstruct annotation method to complete the initialization, and the method of @PostConstruct annotations will be called automatically after the dependency injection is complete.
Constructor >> @Autowired >> @PostConstruct
The popular point is that in Class A when initializing, you want to do something else in the process, but because Class A needs a Class B injection and cannot do it in the constructor, use @PostConstruct to do so.
Order of constructor, @Autowired, @PostConstruct in spring