Here's what we often see Springboot startup class Code:
@SpringBootApplication public
class DemoApplication extends Springbootservletinitializer {
@Override
Protected Springapplicationbuilder Configure (Springapplicationbuilder application) {
return application.sources (Demoapplication.class);
} public
static void Main (string[] args) {
springapplication.run (demoapplication.class, args);
}
}
The main focus here is the @springbootapplication annotation, which consists of three annotations:
@Configuration: Represents the Springboot configuration file class for this class.
@EnableAutoConfiguration: Indicates that the springboot default configuration is automatically loaded when the program starts.
@ComponentScan: Indicates that the program starts, automatically scans all classes under the current package and the child package.
Article turned from: http://www.cnblogs.com/michaelShao/p/6694526.html