码迷,mamicode.com
首页 > 移动开发 > 详细

使用@SpringBootApplication注解

时间:2018-07-15 19:49:52      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:很多   system   sam   nts   enable   注解   开发者   com   component   

很多Spring Boot开发者总是使用@Configuration , @EnableAutoConfiguration 和 @ComponentScan 注解他们的main类。
由于这些注解被如此频繁地一块使用(特别是你遵循以上最佳实践时),Spring Boot提供一个方便的@SpringBootApplication 选择。
@SpringBootApplication 注解等价于以默认属性使用 @Configuration , @EnableAutoConfiguration 和 @ComponentScan 。
same as @Configuration @EnableAutoConfiguration @ComponentScan
@SpringBootApplication
public class BootdoApplication {
    public static void main(String[] args) {
        SpringApplication.run(BootdoApplication.class, args);
        System.out.println("ヾ(?°?°?)??    bootdo启动成功      ヾ(?°?°?)??\n" +
                " ______                    _   ______            \n" +
                "|_   _ \\                  / |_|_   _ `.          \n" +
                "  | |_) |   .--.    .--. `| |-‘ | | `. \\  .--.   \n" +
                "  |  __‘. / .‘`\\ \\/ .‘`\\ \\| |   | |  | |/ .‘`\\ \\ \n" +
                " _| |__) || \\__. || \\__. || |, _| |_.‘ /| \\__. | \n" +
                "|_______/  ‘.__.‘  ‘.__.‘ \\__/|______.‘  ‘.__.‘  ");
    }
}

 

使用@SpringBootApplication注解

标签:很多   system   sam   nts   enable   注解   开发者   com   component   

原文地址:https://www.cnblogs.com/xyhero/p/fed3ad8f5a302a899259dd80236065d8.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!