You can't run Spring Boot components in a main method, which is why you need to use the CommandLineRunner if you want to quickly test your Spring JDBC components or your Spring JPA repos.
Actually, the Spring CommandLineRunner isn't really a testing tool, although it's often used that way. You can use it to create standalone Spring Boot applications. It's a great tool.
This quick, 60 second CommandLineRunner tutorial is better than the Spring CommandLineRunner JavaDoc. It shows you exactly what you need to know to get started with this Spring component.
Auf dieser Seite können Sie das Online-Video Spring Boot CommandLineRunner mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Cameron McKenzie 24 Juli 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 420 Mal angesehen und es wurde von 6 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!