In spring boot, use @springbootapplication to specify that the class is the application startup class.
 
Automatically scans for the corresponding annotations under the current class and sub packages register as spring beans,
 
The application is started in the main method of the class by using the Springapplication Run method.
 
eg
 
[Java] view plain copy package Com.lanhuigu;   Import org.springframework.boot.SpringApplication;      Import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Springbootapp {public static void main (string[] args) {Springapp       Lication.run (Springbootapp.class, args); Using @springbootapplication annotations is equivalent to using @configuration @EnableAutoConfiguration @ComponentScan
 
 
The default properties of these three annotations, and the use of @springbootapplication can also be used to engage @enableautoconfiguration @ComponentScan.
 
Where @componentscan is useful, you can specify that scanning some packages under the following annotations are automatically registered as spring beans:
 
@Component, @Service, @Repository, @Controller, @Entity and so on.
 
eg
 
  [Java]    View plain  copy package com.lanhuigu;      Import  org.springframework.boot.SpringApplication;   import  org.springframework.boot.autoconfigure.springbootapplication;   import  org.springframework.context.annotation.componentscan;      @SpringBootApplication     @ComponentScan (basepackages = {"Com.lanhuigu", "COM.GHG"})// string[]   Public  class SpringBootApp {               Public static void main ( String[] args )  {            springapplication.run (Springbootapp.class, args);        }  }