diff --git a/src/reference/docbook/validation.xml b/src/reference/docbook/validation.xml index 913b3416281..de80df0cec7 100644 --- a/src/reference/docbook/validation.xml +++ b/src/reference/docbook/validation.xml @@ -1081,8 +1081,7 @@ public interface ConversionService { To register a default ConversionService with Spring, add the following bean definition with id conversionService: ]]> - + class="org.springframework.context.support.ConversionServiceFactoryBean"/>]]> A default ConversionService can convert between strings, numbers, enums, collections, maps, and other common types. To supplement or @@ -1447,7 +1446,7 @@ public interface FormatterRegistrar { and Date types will be installed, including support for the @NumberFormat and @DateTimeFormat annotations. Full support for the Joda Time formatting library is also installed if Joda Time is present on the - classpath. + classpath. To inject a ConversionService instance with custom formatters and converters registered, set the conversion-service attribute and then @@ -1485,8 +1484,7 @@ public interface FormatterRegistrar { - -]]> +]]> See and @@ -1507,15 +1505,15 @@ public interface FormatterRegistrar { you can change this by defining your own global format. You will need to ensure that Spring does not register default - formatters and instead you should register all formatters manually. Use the + formatters, and instead you should register all formatters manually. Use the org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar or org.springframework.format.datetime.DateFormatterRegistrar - class depending on your use of the Joda Time library. + class depending on whether you use the Joda Time library. For example, the following Java configuration will register a global 'yyyyMMdd' format. This example does not depend on the - Joda Time: - @Configurable + Joda Time library: + @Configuration public class AppConfig { @Bean @@ -1565,14 +1563,13 @@ public class AppConfig { - -]]> + ]]> Joda Time provides separate distinct types to represent date, time and - date-time values. The dateFormatter - , timeFormatter and dateTimeFormatter + date-time values. The dateFormatter, + timeFormatter and dateTimeFormatter properties of the JodaTimeFormatterRegistrar should be used to configure the different formats for each type. The DateTimeFormatterFactoryBean provides a @@ -1796,8 +1793,7 @@ BindingResult results = binder.getBindingResult(); public class MyController { @RequestMapping("/foo", method=RequestMethod.POST) - public void processFoo(@Valid Foo foo) { /* ... */ } - + public void processFoo(@Valid Foo foo) { /* ... */ } Spring MVC will validate a @Valid object after binding so-long as an appropriate Validator has been configured. @@ -1846,8 +1842,7 @@ public class MyController { - -]]> +]]>
@@ -1876,8 +1871,7 @@ public class MyController { - -]]> +]]> With this minimal configuration, anytime a @Valid @Controller input is encountered, it will be validated by the JSR-303 provider.