Code example for DefaultConversionService

0
	} 
 
	@Test 
	public void resolveOptional() throws Exception { 
		ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer(); 
		initializer.setConversionService(new DefaultConversionService()); 
		WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer); 
 
		Object result = resolver.resolveArgument(paramOptional, null, webRequest, binderFactory); 
		assertEquals(Optional.class, result.getClass()); 
		assertEquals(Optional.empty(), result); 
 
		this.request.addParameter("name", "123"); 
		result = resolver.resolveArgument(paramOptional, null, webRequest, binderFactory); 
		assertEquals(Optional.class, result.getClass()); 
		assertEquals(123, ((Optional) result).get()); 
	} 
 
 
	public void params(@RequestParam(value = "name", defaultValue = "bar") String param1,