Add comment about Validators.

This commit is contained in:
Jon Brisbin
2012-04-26 14:17:22 -05:00
parent 2f0c20bd31
commit 4c0b4a8867
2 changed files with 16 additions and 2 deletions

View File

@@ -68,11 +68,11 @@ public class ValidatingRepositoryEventListener
}
@Override protected void onBeforeLinkSave(Object parent, Object linked) {
validate("beforeChildSave", parent);
validate("beforeLinkSave", parent);
}
@Override protected void onAfterLinkSave(Object parent, Object linked) {
validate("afterChildSave", parent);
validate("afterLinkSave", parent);
}
@Override protected void onBeforeDelete(Object entity) {

View File

@@ -9,6 +9,20 @@
<jpa:repositories base-package="org.springframework.data.rest.test.webmvc"/>
<!--
This validator will be picked up automatically. The default configuration is to look at the bean name
and figure out what event you're interested in. This validator is interested in 'beforeSave' events
because the word 'beforeSave' appears in the first part of the bean name. It recognizes:
- beforeSave
- afterSave
- beforeDelete
- afterDelete
- beforeLinkSave
- afterLinkSave
What you put after that doesn't matter, you just need to make the bean name unique, of course.
-->
<bean id="beforeSavePersonValidator" class="org.springframework.data.rest.test.webmvc.PersonValidator"/>
</beans>