package com.example.hello.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/get")
public class GetApiController {
	//111111111
    @GetMapping(path = "/hello") // http://localhost:8080/api/get/hello
    public String getHello(){
        return "get Hello";
    }
	// 2222222
    // http://localhost8080/api/get/pat-variable/{name}
    // 개발을 하다가 pathVariable과 변수명이 다를때 
    @GetMapping("/path-variable/{name}")
    public String pathVariable(@PathVariable(name = "name") String pathName){ // 이런식으로 하면 된다.
        System.out.println("PathVariable : " + pathName);
        return pathName;
    }
}
pathVariable만 실행을 해보겠다.
뒤의 {name} 값을 변경해도 올바르게 된다는걸 볼 수 있다.