package com.cos.controllerdemo.web;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class QueryPathController {
@GetMapping("/chicken")
public String chickenQuery(String type) { // 매서드에 쿼리스트링으로 넣기만 하면 받아줌
return type + " 배달입니다 (쿼리 스트링)";
}
@GetMapping("/chicken/{type}")
public String chickenPath(@PathVariable String type) {
return type + " 배달입니다 (주소 변수 매핑)";
}
}
스프링 부트에서는 쿼리스트링은 안쓰고, 주소변수매핑을 자주 사용함