私の言語に従ってSpringのメッセージ検証を正しく取得するにはどうすればよいですか?
@Entity
public class News {
@Id
private Integer idNews;
@NotEmpty(message = "{news.title.error}")
@Column
private String title;
........
}
私の設定で:
<!-- locale change using a cookie -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver" >
<property name="defaultLocale" value="pt" />
</bean>
<!-- Access resource bundles with the specified basename -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>/WEB-INF/i18n/messages</value>
<value>/WEB-INF/i18n/validation</value>
</list>
</property>
</bean>
<!-- JSR-303 -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="validationMessageSource" ref="messageSource"/>
</bean>