Fix typo and polish formatting
This commit is contained in:
parent
4a8be69099
commit
202b15e19b
|
|
@ -1081,8 +1081,7 @@ public interface ConversionService {
|
||||||
<para> To register a default ConversionService with Spring, add the
|
<para> To register a default ConversionService with Spring, add the
|
||||||
following bean definition with id <code>conversionService</code>: </para>
|
following bean definition with id <code>conversionService</code>: </para>
|
||||||
<programlisting language="xml"><![CDATA[<bean id="conversionService"
|
<programlisting language="xml"><![CDATA[<bean id="conversionService"
|
||||||
class="org.springframework.context.support.ConversionServiceFactoryBean"/>]]>
|
class="org.springframework.context.support.ConversionServiceFactoryBean"/>]]></programlisting>
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para> A default ConversionService can convert between strings, numbers,
|
<para> A default ConversionService can convert between strings, numbers,
|
||||||
enums, collections, maps, and other common types. To supplement or
|
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
|
and Date types will be installed, including support for the
|
||||||
@NumberFormat and @DateTimeFormat annotations. Full support for the Joda
|
@NumberFormat and @DateTimeFormat annotations. Full support for the Joda
|
||||||
Time formatting library is also installed if Joda Time is present on the
|
Time formatting library is also installed if Joda Time is present on the
|
||||||
classpath. </para>
|
classpath.</para>
|
||||||
|
|
||||||
<para> To inject a ConversionService instance with custom formatters and
|
<para> To inject a ConversionService instance with custom formatters and
|
||||||
converters registered, set the conversion-service attribute and then
|
converters registered, set the conversion-service attribute and then
|
||||||
|
|
@ -1485,8 +1484,7 @@ public interface FormatterRegistrar {
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>]]></programlisting>
|
||||||
]]></programlisting>
|
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para> See <xref linkend="format-FormatterRegistrar-SPI"/> and
|
<para> See <xref linkend="format-FormatterRegistrar-SPI"/> and
|
||||||
|
|
@ -1507,15 +1505,15 @@ public interface FormatterRegistrar {
|
||||||
you can change this by defining your own global format.</para>
|
you can change this by defining your own global format.</para>
|
||||||
|
|
||||||
<para>You will need to ensure that Spring does not register default
|
<para>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
|
||||||
<classname>org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar</classname>
|
<classname>org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar</classname>
|
||||||
or <classname>org.springframework.format.datetime.DateFormatterRegistrar</classname>
|
or <classname>org.springframework.format.datetime.DateFormatterRegistrar</classname>
|
||||||
class depending on your use of the Joda Time library.</para>
|
class depending on whether you use the Joda Time library.</para>
|
||||||
|
|
||||||
<para>For example, the following Java configuration will register a global
|
<para>For example, the following Java configuration will register a global
|
||||||
'<literal>yyyyMMdd</literal>' format. This example does not depend on the
|
'<literal>yyyyMMdd</literal>' format. This example does not depend on the
|
||||||
Joda Time:</para>
|
Joda Time library:</para>
|
||||||
<programlisting language="java">@Configurable
|
<programlisting language="java">@Configuration
|
||||||
public class AppConfig {
|
public class AppConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
@ -1565,14 +1563,13 @@ public class AppConfig {
|
||||||
</set>
|
</set>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
</beans>
|
</beans>]]></programlisting>
|
||||||
]]></programlisting>
|
|
||||||
|
|
||||||
<note>
|
<note>
|
||||||
<para>Joda Time provides separate distinct types to represent
|
<para>Joda Time provides separate distinct types to represent
|
||||||
<literal>date</literal>, <literal>time</literal> and
|
<literal>date</literal>, <literal>time</literal> and
|
||||||
<literal>date-time</literal> values. The <literal>dateFormatter</literal>
|
<literal>date-time</literal> values. The <literal>dateFormatter</literal>,
|
||||||
, <literal>timeFormatter</literal> and <literal>dateTimeFormatter</literal>
|
<literal>timeFormatter</literal> and <literal>dateTimeFormatter</literal>
|
||||||
properties of the <classname>JodaTimeFormatterRegistrar</classname> should
|
properties of the <classname>JodaTimeFormatterRegistrar</classname> should
|
||||||
be used to configure the different formats for each type. The
|
be used to configure the different formats for each type. The
|
||||||
<classname>DateTimeFormatterFactoryBean</classname> provides a
|
<classname>DateTimeFormatterFactoryBean</classname> provides a
|
||||||
|
|
@ -1796,8 +1793,7 @@ BindingResult results = binder.getBindingResult();</programlisting>
|
||||||
public class MyController {
|
public class MyController {
|
||||||
|
|
||||||
@RequestMapping("/foo", method=RequestMethod.POST)
|
@RequestMapping("/foo", method=RequestMethod.POST)
|
||||||
public void processFoo(<emphasis role="bold">@Valid</emphasis> Foo foo) { <lineannotation>/* ... */</lineannotation> }
|
public void processFoo(<emphasis role="bold">@Valid</emphasis> Foo foo) { <lineannotation>/* ... */</lineannotation> }</programlisting>
|
||||||
</programlisting>
|
|
||||||
|
|
||||||
<para> Spring MVC will validate a @Valid object after binding so-long as
|
<para> Spring MVC will validate a @Valid object after binding so-long as
|
||||||
an appropriate Validator has been configured. </para>
|
an appropriate Validator has been configured. </para>
|
||||||
|
|
@ -1846,8 +1842,7 @@ public class MyController {
|
||||||
|
|
||||||
<mvc:annotation-driven validator="globalValidator"/>
|
<mvc:annotation-driven validator="globalValidator"/>
|
||||||
|
|
||||||
</beans>
|
</beans>]]></programlisting>
|
||||||
]]></programlisting>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="validation-mvc-jsr303">
|
<section id="validation-mvc-jsr303">
|
||||||
|
|
@ -1876,8 +1871,7 @@ public class MyController {
|
||||||
<!-- JSR-303 support will be detected on classpath and enabled automatically -->
|
<!-- JSR-303 support will be detected on classpath and enabled automatically -->
|
||||||
<mvc:annotation-driven/>
|
<mvc:annotation-driven/>
|
||||||
|
|
||||||
</beans>
|
</beans>]]></programlisting>
|
||||||
]]></programlisting>
|
|
||||||
|
|
||||||
<para> With this minimal configuration, anytime a @Valid @Controller
|
<para> With this minimal configuration, anytime a @Valid @Controller
|
||||||
input is encountered, it will be validated by the JSR-303 provider.
|
input is encountered, it will be validated by the JSR-303 provider.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue