패스 파라미터

Rae-eun Yang·2024년 7월 5일
0

패스 파라미터

/user/1/lecture
url에 있는 변수값

패스 파라미터는 어떻게 처리될까?

    @GetMapping(path="/hello-world/path-variable/{name}")
    public HelloWorldBean helloWorldPathVariable(@PathVariable String name) {
        return new HelloWorldBean("Hello World");
    }

위와 같은 컨트롤러가 있다고 가정하겠다
우리가 /hello-world/path-variable/이름 을 넣으면 Spring MVC는 '이름'을 @PathVariable String name에 매핑시킨다

profile
ContentsDev Manager

0개의 댓글