Skip to content

Commit 40a24bd

Browse files
committed
Merge pull request #26937 from quaff
* gh-26937: Polish "Update docs to use @SpringBootConfiguration not @configuration" Update docs to use @SpringBootConfiguration not @configuration Closes gh-26937
2 parents b8a5d9b + ba9244b commit 40a24bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/using-spring-boot.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ A single `@SpringBootApplication` annotation can be used to enable those three f
364364

365365
* `@EnableAutoConfiguration`: enable <<using-boot-auto-configuration,Spring Boot's auto-configuration mechanism>>
366366
* `@ComponentScan`: enable `@Component` scan on the package where the application is located (see <<using-boot-structuring-your-code,the best practices>>)
367-
* `@Configuration`: allow to register extra beans in the context or import additional configuration classes
367+
* `@SpringBootConfiguration`: enable registration of extra beans in the context or the import of additional configuration classes.
368+
An alternative to Spring's standard `@Configuration` that aids <<spring-boot-features#boot-features-testing-spring-boot-applications-detecting-config,configuration detection>> in your integration tests.
368369

369370
[source,java,indent=0]
370371
----
@@ -373,7 +374,7 @@ A single `@SpringBootApplication` annotation can be used to enable those three f
373374
import org.springframework.boot.SpringApplication;
374375
import org.springframework.boot.autoconfigure.SpringBootApplication;
375376
376-
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan
377+
@SpringBootApplication // same as @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan
377378
public class Application {
378379
379380
public static void main(String[] args) {
@@ -395,11 +396,11 @@ For instance, you may not want to use component scan or configuration properties
395396
package com.example.myapplication;
396397
397398
import org.springframework.boot.SpringApplication;
399+
import org.springframework.boot.SpringBootConfiguration;
398400
import org.springframework.context.annotation.ComponentScan
399-
import org.springframework.context.annotation.Configuration;
400401
import org.springframework.context.annotation.Import;
401402
402-
@Configuration(proxyBeanMethods = false)
403+
@SpringBootConfiguration(proxyBeanMethods = false)
403404
@EnableAutoConfiguration
404405
@Import({ MyConfig.class, MyAnotherConfig.class })
405406
public class Application {

0 commit comments

Comments
 (0)