It combines @Configuration, @EnableAutoConfiguration and @ComponentScan of the current package downwards.
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
// Equivalent to:
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class App { }
Component scanning starts at the class's own package.
A @Service in a sibling package is never found - a classic "bean not created" cause.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-11