當前位置:編程學習大全網 - 編程軟體 - spring的常用註解是什麽?

spring的常用註解是什麽?

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

  • 上一篇:能夠控制氣缸行程的方式,是采用伺服控制還是氣缸本身帶有此功能的?
  • 下一篇:惡搞關機文件
  • copyright 2024編程學習大全網