← 返回首页
spring-boot-tutorials/run-on-startup at main · StackTipsLab/spring-boot-tutorials · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Latest commit

 

History

History
 main
Top

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
View all files

readme.md

How to Execute Code on Spring Boot Application Startup?

Spring boot offers multiple options, for executing your code during the application startup. This post covers some of the ‘out of the box’ practices recommended by the Spring developers. There are mainly 3 options

  • Option-1: Using @PostConstruct annotation
  • Option-2: Using ApplicationRunner or Command Line Runner Interface
  • Option-3: Using Spring Boot Events

In this article, we will cover all of the available options and look into the best practices dos and don'ts.

Read full article on stacktips.com

Related topics:

Footer

© 2026 GitHub, Inc.