You click Run. The console fills with lines you don't read. A few seconds later, one line appears that you do read: Started DemoApplication in 2.9 seconds . Your API is live.
So what happened in those 3 seconds? A Spring Boot application is a normal Java program whose main() hands control to Spring. Spring then finds your classes, turns them into objects called beans, plugs them together, sets up a web server for you, and starts listening on port 8080.
That's the whole story. Now let's slow it down, because once you can see these steps, the scary startup errors stop being scary.
A tiny app to follow
Here is a small bookshop app. Three classes, all in the package com.example.demo (or packages below it):
@SpringBootApplication public class DemoApplication { public static void main ( String [ ] args ) { SpringApplication . run ( DemoApplication . class , args ) ; } }
@Service class BookService { List < String > all ( ) { return List .β¦