• By the spring management
  • Implement the InitializingBean interface
  • Rewrite the afterPropertiesSet method

The InitializingBean interface provides a way for beans to initialize methods, including only afterPropertiesSet methods, which all classes that inherit the interface execute when initializing the bean.