Login http://47.92.39.225:8080/See more articles
18. Using @springbootapplication annotations
Many spring boot developers often use @configuration, @EnableAutoConfiguration, @ComponentScan annotate their main class, Since these annotations are used so frequently (especially when following the best practices above), Spring boot provides a handy @springbootapplication annotation instead.
@SpringBootApplication annotations are equivalent to using @configuration with default properties, @EnableAutoConfiguration and @componentscan:
Package com.example.myproject;
Import org.springframework.boot.SpringApplication;
Import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication//Same as @Configuration @EnableAutoConfiguration @ComponentScan public
class Application { Public
static void Main (string[] args) {
springapplication.run (application.class, args);
}
}
Note @SpringBootApplication Annotations also provide aliases (aliases) for customizing the @enableautoconfiguration and @componentscan properties.