您的位置:首页 > 移动开发

Spring注解之:@SpringBootApplication

2016-02-07 18:27 761 查看
@SpringBootApplication
 is
a convenience annotation that adds all of the following:

@Configuration
 tags
the class as a source of bean definitions for theapplication context. 

@EnableAutoConfiguration
 tells
Spring Boot to start adding beans based on classpath settings,other beans,and
various property settings.

Normally you would add 
@EnableWebMvc
 for
a Spring MVC app, but Spring Boot adds it automatically when it sees spring-webmvc on the classpath. This flags the application as a web application and activates key behaviors such as
setting up a 
DispatcherServlet
.
(DispatcherServlet是什么可看这里 http://blog.csdn.net/zhouhuakang/article/details/50643034)
@ComponentScan
 tells
Spring to look for other components, configurations, and services in the the 
hello
 package,

allowing it to find the 
HelloController
.

参考
1.https://spring.io/guides/gs/spring-boot/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: