Guice + Hibernate Validator

673 views
Skip to first unread message

egm...@gmail.com

unread,
Feb 4, 2014, 9:46:21 AM2/4/14
to google...@googlegroups.com
Apache BVal integrates nicely with Guice, pretty much out of the box. Is there something similar for Guice and Hibernate Validator?
Also is there a primer/tutorial/guide somewhere that explains how best to integrate Hibernate Validator with Gucie?

Field validation is sufficient for my needs for now, method validation is not required.

Thanks in advance.

Paweł Cesar Sanjuan Szklarz

unread,
Feb 4, 2014, 9:54:02 AM2/4/14
to google...@googlegroups.com
Hi.

Governator has a integration to field validations:

Pawel.


--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

egm...@gmail.com

unread,
Feb 4, 2014, 10:04:23 AM2/4/14
to google...@googlegroups.com
I'm posting this after a quick scan through the code, so I could be terribly wrong.
I couldn't find any bindings for e.g. ValidatorFactory (a static method is called to create one, here: https://github.com/Netflix/governator/blob/450ba3bc71a436bd72bca1f1dedd5f5d5e00b433/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java#L102) or ConstraintValidator (so that one can write custom constraints). This becomes apparent if you contrast with BVal-Guice integration. 

Am I missing something?

Thanks again.

Paweł Cesar Sanjuan Szklarz

unread,
Feb 4, 2014, 10:18:12 AM2/4/14
to google...@googlegroups.com
Hi.

I have several project where this is used, I just configure governator as writen in the documentation and it works. I have not look inside to check how it is implemented.

I see that You expect to have a binding to ValidatorFactory. The approach of governator is to create 2 injectors, the boostrap injector is created to manage the creation of the application final injector. 

It looks like the ValidationFactory live in the bootstrap injector and is not accessible to be configured.

Pawel.



--
Reply all
Reply to author
Forward
0 new messages