Search in sources :

Example 6 with DefaultParameterNameDiscoverer

use of org.springframework.core.DefaultParameterNameDiscoverer in project spring-framework by spring-projects.

the class HeaderMethodArgumentResolverTests method setup.

@Before
public void setup() throws Exception {
    @SuppressWarnings("resource") GenericApplicationContext cxt = new GenericApplicationContext();
    cxt.refresh();
    this.resolver = new HeaderMethodArgumentResolver(new DefaultConversionService(), cxt.getBeanFactory());
    Method method = ReflectionUtils.findMethod(getClass(), "handleMessage", (Class<?>[]) null);
    this.paramRequired = new SynthesizingMethodParameter(method, 0);
    this.paramNamedDefaultValueStringHeader = new SynthesizingMethodParameter(method, 1);
    this.paramSystemPropertyDefaultValue = new SynthesizingMethodParameter(method, 2);
    this.paramSystemPropertyName = new SynthesizingMethodParameter(method, 3);
    this.paramNotAnnotated = new SynthesizingMethodParameter(method, 4);
    this.paramOptional = new SynthesizingMethodParameter(method, 5);
    this.paramNativeHeader = new SynthesizingMethodParameter(method, 6);
    this.paramRequired.initParameterNameDiscovery(new DefaultParameterNameDiscoverer());
    GenericTypeResolver.resolveParameterType(this.paramRequired, HeaderMethodArgumentResolver.class);
}
Also used : SynthesizingMethodParameter(org.springframework.core.annotation.SynthesizingMethodParameter) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) DefaultParameterNameDiscoverer(org.springframework.core.DefaultParameterNameDiscoverer) DefaultConversionService(org.springframework.core.convert.support.DefaultConversionService) Method(java.lang.reflect.Method) Before(org.junit.Before)

Aggregations

DefaultParameterNameDiscoverer (org.springframework.core.DefaultParameterNameDiscoverer)6 MethodParameter (org.springframework.core.MethodParameter)4 SynthesizingMethodParameter (org.springframework.core.annotation.SynthesizingMethodParameter)4 Method (java.lang.reflect.Method)2 Before (org.junit.Before)2 DefaultConversionService (org.springframework.core.convert.support.DefaultConversionService)2 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)1