@SpringBootConfiguration is a specialization of @Configuration. It marks a class as the primary configuration class of a Spring Boot application, so it can declare @Bean methods just like a regular @Configuration class.
Specify whether @Bean methods should get proxied in order to enforce bean lifecycle behavior, e.g. to return shared singleton bean instances even in case of direct @Bean method calls in user code.
(Since 2.2)
@SpringBootConfiguration is itself annotated with @Configuration, so it is nothing but a configuration meta-annotation: it behaves exactly like @Configuration and simply gives Spring Boot a dedicated marker for the application's primary configuration class.
@Configuration - Marks the class as a source of bean definitions (@Bean methods). Because it is a meta-annotation here, any class annotated with @SpringBootConfiguration is processed as a configuration class. Its proxyBeanMethods attribute is exposed through @AliasFor so it can be set directly on @SpringBootConfiguration.
@Indexed - A Spring marker that tells the annotation processor (spring-context-indexer) to add the annotated class to a build-time META-INF/spring.components index. At startup, component scanning can read this index instead of scanning the classpath, which speeds up startup in large applications. The index is only an optimization, and the indexer has been deprecated in recent Spring versions.
@Documented - A standard Java meta-annotation. It makes @SpringBootConfiguration show up in the generated Javadoc of any class annotated with it. It has no effect at runtime.
How @SpringBootConfiguration relates to @SpringBootApplication
@SpringBootApplication is a convenience annotation composed of three annotations:
@SpringBootConfiguration - marks the class as the Boot configuration
@EnableAutoConfiguration - turns on auto-configuration
@ComponentScan - scans the package and sub-packages for components
So the following two classes are equivalent:
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
Why use it without @SpringBootApplication?
Configuration without auto-configuration or component scanning. Use it when you want a Boot-recognized configuration class but want to control everything explicitly, for example with @Import or selected @Bean methods.
Test configuration. Test annotations such as @SpringBootTest, @WebMvcTest and @DataJpaTest look for a class annotated with @SpringBootConfiguration. They search upward from the test class package. A plain @Configuration class is not picked up by this search.
Tutorials and focused examples. You can keep a tiny application context with only the beans you need, without the scanning and auto-configuration that @SpringBootApplication brings in.
2026-10-31 21:08:37.225 INFO 616 --- [ main] com.logicbig.example.MainExample : Starting MainExample on JoePC with PID 616 (D:\LogicBig\example-projects\spring-boot\spring-boot-configuration-annotation\target\classes started by joe2 in D:\LogicBig\example-projects\spring-boot\spring-boot-configuration-annotation) 2026-10-31 21:08:37.228 INFO 616 --- [ main] com.logicbig.example.MainExample : No active profile set, falling back to default profiles: default 2026-10-31 21:08:37.473 INFO 616 --- [ main] com.logicbig.example.MainExample : Started MainExample in 0.544 seconds (JVM running for 3.333) my bean doSomething method
In above example, we ran the main class directly from IntelliJ IDEA. Alternatively, you can execute it from the command line using your build tool:
Maven:mvn spring-boot:run
Gradle:gradle bootRun
Example Project
Dependencies and Technologies Used:
Spring Boot 4.1.2 Corresponding Spring Framework Version 7.0.10 Version Compatibility: 1.2.0.RELEASE - 4.1.2Version List
×
Version compatibilities of spring-boot-starter-parent with this example:
1.2.0.RELEASE
2.0.0.RELEASE
2.0.1.RELEASE
2.0.2.RELEASE
2.0.3.RELEASE
2.0.4.RELEASE
2.0.5.RELEASE
2.0.6.RELEASE
2.0.7.RELEASE
2.0.8.RELEASE
2.0.9.RELEASE
2.1.0.RELEASE
2.1.1.RELEASE
2.1.2.RELEASE
2.1.3.RELEASE
2.1.4.RELEASE
2.1.5.RELEASE
2.1.6.RELEASE
2.1.7.RELEASE
2.1.8.RELEASE
2.1.9.RELEASE
2.1.10.RELEASE
2.1.11.RELEASE
2.1.12.RELEASE
2.1.13.RELEASE
2.1.14.RELEASE
2.1.15.RELEASE
2.1.16.RELEASE
2.1.17.RELEASE
2.1.18.RELEASE
2.2.0.RELEASE
2.2.1.RELEASE
2.2.2.RELEASE
2.2.3.RELEASE
2.2.4.RELEASE
2.2.5.RELEASE
2.2.6.RELEASE
2.2.7.RELEASE
2.2.8.RELEASE
2.2.9.RELEASE
2.2.10.RELEASE
2.2.11.RELEASE
2.2.12.RELEASE
2.2.13.RELEASE
2.3.0.RELEASE
2.3.1.RELEASE
2.3.2.RELEASE
2.3.3.RELEASE
2.3.4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0.2
4.0.3
4.0.4
4.0.5
4.0.6
4.0.7
4.0.8
4.0.9
4.1.0
4.1.1
4.1.2
Versions in green have been tested.
spring-boot-starter (Core starter, including auto-configuration support, logging and YAML)
JDK 1.8
Build Tool:
spring-boot - Using @SpringBootConfiguration Annotation