1. 程式人生 > >spring boot系統學習(知識點筆記)

spring boot系統學習(知識點筆記)

調試接口 .com tco map aid 結果 ota http 而且

一、http的註解配置

  1、@SpringBootAplication=@SpringBootConfiguration(其實就是個@Configuration)+@EnableAutoConfiguration(能夠自動配置的註解)+@ComponentScan(掃描組件)

  2、@RequestMapping和@RestController不是springboot特有註解,在springmvc裏就有了

  3、@RestController=@Controller+@ResponseBody(把返回結果變為一個json) 所以使用@RestController就可以一個map這樣類型的數據返回成一個json,而不用再用@ResponseBody

    如果這時只有@Controller而沒有@ResponseBody那麽會當成一個視圖返回,需要視圖解析來解析,會報錯。

    如果是前後端分離,只需要給前端提供一個接口的話就使用@RestController,不需要使用@ResponseBody+@Controller

二、工具postman 用來調試接口

   crul "www.baidu.com"可以測單個接口,但是接口會很多,沒法單獨測,而且變動大

spring boot系統學習(知識點筆記)