Spring Boot - How to Run Code upon Application Startup

preview_player
Показать описание
In this video, I'd like to share with you how to run your own custom logics right after your Spring-based application has started.

By upon startup, it means:
- the Spring application context has been initialized
- All beans have been created

To run code upon startup of a Spring-based application, you can use CommandLineRunner or application event listener.
#springboot #springmvc #java
Рекомендации по теме
Комментарии
Автор

When we want to use a service instance we have to @Autowired to use it, but when we use the same service in multiple class, is that instance a singleton? or it will create multiple instances for every request, bro Nam.

ktn