Commit 4290193a authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.5.x'

Closes gh-27025
parents 515072b2 05163863
...@@ -5,7 +5,8 @@ A single `@SpringBootApplication` annotation can be used to enable those three f ...@@ -5,7 +5,8 @@ A single `@SpringBootApplication` annotation can be used to enable those three f
* `@EnableAutoConfiguration`: enable <<using#using.auto-configuration,Spring Boot's auto-configuration mechanism>> * `@EnableAutoConfiguration`: enable <<using#using.auto-configuration,Spring Boot's auto-configuration mechanism>>
* `@ComponentScan`: enable `@Component` scan on the package where the application is located (see <<using#using.structuring-your-code,the best practices>>) * `@ComponentScan`: enable `@Component` scan on the package where the application is located (see <<using#using.structuring-your-code,the best practices>>)
* `@Configuration`: allow to register extra beans in the context or import additional configuration classes * `@SpringBootConfiguration`: enable registration of extra beans in the context or the import of additional configuration classes.
An alternative to Spring's standard `@Configuration` that aids <<features#features.testing.spring-boot-applications.detecting-configuration,configuration detection>> in your integration tests.
[source,java,indent=0,subs="verbatim"] [source,java,indent=0,subs="verbatim"]
---- ----
...@@ -24,5 +25,5 @@ For instance, you may not want to use component scan or configuration properties ...@@ -24,5 +25,5 @@ For instance, you may not want to use component scan or configuration properties
include::{docs-java}/using/usingthespringbootapplicationannotation/individualannotations/MyApplication.java[] include::{docs-java}/using/usingthespringbootapplicationannotation/individualannotations/MyApplication.java[]
---- ----
In this example, `Application` is just like any other Spring Boot application except that `@Component`-annotated classes and `@ConfigurationProperties`-annotated classes are not detected automatically and the user-defined beans are imported explicitly (see `@Import`). In this example, `MyApplication` is just like any other Spring Boot application except that `@Component`-annotated classes and `@ConfigurationProperties`-annotated classes are not detected automatically and the user-defined beans are imported explicitly (see `@Import`).
==== ====
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
package org.springframework.boot.docs.using.usingthespringbootapplicationannotation.individualannotations; package org.springframework.boot.docs.using.usingthespringbootapplicationannotation.individualannotations;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@Configuration(proxyBeanMethods = false) @SpringBootConfiguration(proxyBeanMethods = false)
@EnableAutoConfiguration @EnableAutoConfiguration
@Import({ SomeConfiguration.class, AnotherConfiguration.class }) @Import({ SomeConfiguration.class, AnotherConfiguration.class })
public class MyApplication { public class MyApplication {
......
...@@ -19,7 +19,8 @@ package org.springframework.boot.docs.using.usingthespringbootapplicationannotat ...@@ -19,7 +19,8 @@ package org.springframework.boot.docs.using.usingthespringbootapplicationannotat
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan @SpringBootApplication // same as @SpringBootConfiguration @EnableAutoConfiguration
// @ComponentScan
public class MyApplication { public class MyApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment