Question: At the moment I am doing this in each controller i need it :

```
 @InitBinder
 protected void initBinder(WebDataBinder binder){
   binder.registerCustomEditor(
     Country.class, new CountryPropertyEditor(this.countryService));
 }

```

Which works fine converting my string variable to country, however is there a way I can register this with all controllers ?

Answer: 
To register custom property editor once for whole application override **addFormatters** method of **WebMvcConfigurerAdapter** in your configuration class. 

Example for date (with Java config)

```
@EnableWebMvc
@Configuration
public class WebConfiguration extends WebMvcConfigurerAdapter {

    // ...

    @Override
    public void addFormatters( final FormatterRegistry registry ) {
        registry.addFormatterForFieldType( java.sql.Date.class, new DateFormatter() );
    }

    // ... 
}

```

and make your own class for date formatting which implements **Formatter** interface, something like this 

```
public final class DateFormatter implements Formatter<java.sql.Date> {

    private String pattern;

    public DateFormatter() {
        this( "yyyy-MM-dd" );
    }

    public DateFormatter( final String pattern ) {
        this.pattern = pattern;
    }

    public String print( final java.sql.Date date, final Locale locale ) {
        if ( date == null ) {
            return "";
        }
        return getDateFormat( locale ).format( date );
    }

    public java.sql.Date parse( final String formatted, final Locale locale ) throws
        ParseException {
        if ( formatted.length() == 0 ) {
            return null;
    }
    java.util.Date udDate = getDateFormat( locale ).parse( formatted );
    return new java.sql.Date( udDate.getTime() );
}

protected DateFormat getDateFormat( final Locale locale ) {
    DateFormat dateFormat = new SimpleDateFormat( this.pattern, locale );
    dateFormat.setLenient( false );
    return dateFormat;
}

```

}

That's it.
Can you just put it in the superclass of your controllers?