Spring Boot常用註解
1、@SpringBootApplication
替代 @SpringBootConfiguration、@EnableAutoConfiguration、@ComponentScan
2、@ImportAutoConfiguration
導入配置類,壹般做測試的時候使用,正常優先使用@EnableAutoConfiguration?
3、@SpringBootConfiguration
替代@Configuration
4、@ImportResource
將資源導入容器
5、@PropertySource?
導入properties文件
6、PropertySources
@PropertySource 的集合
擴展資料:
Controller 該類為Controller。
RequestMapping 配置方法路徑等信息。
ResponseBody 返回值,例如JSON,XML。
PathVariable 獲取RESTFUL路徑中的值如 /company/{corpId}/dept/{deptId}。
RequestParam 獲取Request參數值如xxx?from=index_nav。
Component,Repository,Service。
壹般用Repository,service用Service,需要多個service時,壹般用Componet。
百度百科-spring MVC