@SpringBootApplication

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了@SpringBootApplication相关的知识,希望对你有一定的参考价值。

1. spring 文档说明

Many Spring Boot developers always have their main class annotated with @Configuration, @EnableAutoConfiguration and @ComponentScan. Since these annotations are so frequently used together (especially if you follow the best practices above), Spring Boot provides a convenient @SpringBootApplication alternative.

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes。

@SpringBootApplication是 @Configuration, @EnableAutoConfiguration and @ComponentScan 的组合。

使用时一般写明要扫描的包 @SpringBootApplication(scanBasePackages="com.example")

 

stereotype annotations 构造型注解

以上是关于@SpringBootApplication的主要内容,如果未能解决你的问题,请参考以下文章

使用idea引入注解@SpringBootApplication报错Cannot resolve symbol 'SpringBootApplication'

Spring编程:springboot @SpringBootApplication注解

Spring 将属性文件中的值读入 @SpringBootApplication 类

使用@SpringBootApplication注解

@SpringBootApplication注解

什么是 SpringBootApplication 功能?