heowc / programming-study

개발 스킬, 언어, 설계에 대한 공유 저장소
https://heowc.dev/programming-study/repo/
53 stars 5 forks source link

[spring] method argument resolver #97

Closed heowc closed 5 years ago

heowc commented 5 years ago
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public ApplicationRunner runner(RequestMappingHandlerAdapter adapter) {
        return args -> {
            adapter.getArgumentResolvers().stream().map(HandlerMethodArgumentResolver::toString).forEach(System.out::println);
        };
    }
}
org.springframework.web.method.annotation.RequestParamMethodArgumentResolver@5b69fd74
org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver@f325091
org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver@437e951d
org.springframework.web.servlet.mvc.method.annotation.PathVariableMapMethodArgumentResolver@77b325b3
org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver@63a5e46c
org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver@7e8e8651
org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor@49ef32e0
org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor@271f18d3
org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver@6bd51ed8
org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver@61e3a1fd
org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver@51abf713
org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver@eadb475
org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver@4d4d48a6
org.springframework.web.servlet.mvc.method.annotation.SessionAttributeMethodArgumentResolver@315df4bb
org.springframework.web.servlet.mvc.method.annotation.RequestAttributeMethodArgumentResolver@3fc08eec
org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver@5cad8b7d
org.springframework.web.servlet.mvc.method.annotation.ServletResponseMethodArgumentResolver@7b02e036
org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor@25243bc1
org.springframework.web.servlet.mvc.method.annotation.RedirectAttributesMethodArgumentResolver@1e287667
org.springframework.web.method.annotation.ModelMethodProcessor@2e6ee0bc
org.springframework.web.method.annotation.MapMethodProcessor@4201a617
org.springframework.web.method.annotation.ErrorsMethodArgumentResolver@467f77a5
org.springframework.web.method.annotation.SessionStatusMethodArgumentResolver@1bb9aa43
org.springframework.web.servlet.mvc.method.annotation.UriComponentsBuilderMethodArgumentResolver@420bc288
org.springframework.web.method.annotation.RequestParamMethodArgumentResolver@df5f5c0
org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor@308a6984
heowc commented 5 years ago

DispatcherServletRequestMappingHandlerAdapterServletInvocableHandlerMethodHandlerMethodArgumentResolverCompositexxxxHandlerMethodArgumentResolver

heowc commented 5 years ago

코드

@RestController
public class ExampleController {

    @GetMapping("/")
    public String get(String message) {
        return message;
    }
}

결과

[GET] http://localhost:8080/?message=test
test