packageorg.springframework.boot;importjava.lang.annotation.Documented;importjava.lang.annotation.ElementType;importjava.lang.annotation.Retention;importjava.lang.annotation.RetentionPolicy;importjava.lang.annotation.Target;importorg.springframework.context.annotation.Configuration;/** * Indicates that a class provides Spring Boot application * {@link Configuration @Configuration}. Can be used as an alternative to the Spring's * standard {@code @Configuration} annotation so that configuration can be found * automatically (for example in tests). * <p> * Application should only ever include <em>one</em> {@code @SpringBootConfiguration} and * most idiomatic Spring Boot applications will inherit it from * {@code @SpringBootApplication}. * * @author Phillip Webb * @since 1.4.0 */@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Configurationpublic @interfaceSpringBootConfiguration {}
标识一个提供 Spring Boot application 的 java 配置类,@Configuration 注解表示当前的 java 类是一个配置类。可以作为 Spring 标准 @Configuration 替换方案,配置可以自动被寻找到。
整个项目应用当中应该只包含一个 @SpringBootConfiguration 注解,大多数的 Spring Boot 应用都会直接从 @SpringBootApplication 注解当中继承 @SpringBootConfiguration 注解。