@RestController
(1)標註在controller類上面,當瀏覽器端發送請求。例如 127.0.0.1:8080/hello,那麼springboot就會拿着 /hello 去找標註有 @RestController的類,去找 @RequestMapping("/hello") 修飾的方法(或者 @GetMapping("/hello") 的方法)
(2)將方法的返回值,轉化爲json格式的數據
(3)如果是進行視圖跳轉,請使用 @Controller
補充中~
@RestController
(1)標註在controller類上面,當瀏覽器端發送請求。例如 127.0.0.1:8080/hello,那麼springboot就會拿着 /hello 去找標註有 @RestController的類,去找 @RequestMapping("/hello") 修飾的方法(或者 @GetMapping("/hello") 的方法)
(2)將方法的返回值,轉化爲json格式的數據
(3)如果是進行視圖跳轉,請使用 @Controller
補充中~
Spring boot 配置數據源 spring: mvc: favicon: enabled: false datasource: primary: username: root