Repository: deltaspike Updated Branches: refs/heads/master e836d91a4 -> 13330996c
[DELTASPIKE-DOC] - Fix bean-validation doc sources formating Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/13330996 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/13330996 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/13330996 Branch: refs/heads/master Commit: 13330996cd7fb8700bdb35cd591e386b194bba54 Parents: e836d91 Author: Rafael Benevides <[email protected]> Authored: Mon Oct 6 18:33:01 2014 -0300 Committer: Rafael Benevides <[email protected]> Committed: Mon Oct 6 18:33:01 2014 -0300 ---------------------------------------------------------------------- .../src/main/asciidoc/bean-validation.adoc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/13330996/documentation/src/main/asciidoc/bean-validation.adoc ---------------------------------------------------------------------- diff --git a/documentation/src/main/asciidoc/bean-validation.adoc b/documentation/src/main/asciidoc/bean-validation.adoc index 0210948..e756824 100644 --- a/documentation/src/main/asciidoc/bean-validation.adoc +++ b/documentation/src/main/asciidoc/bean-validation.adoc @@ -7,40 +7,37 @@ == Introduction The main feature of the Bean Validation module is to provide CDI -integration in to `ConstraintValidator`s. This allows you to inject CDI +integration in to `ConstraintValidator`\`s. This allows you to inject CDI objects, EJBs etc in to your validators. === Scoping -`ConstraintValidator`s will inherit whatever scope as defined in the -bean class. Inherently, a `ConstraintValidator` may be invoked by -multiple threads so please keep that in mind when using them. You should -consider using at least `RequestScoped` validators. +`ConstraintValidator`\`s will inherit whatever scope as defined in the bean class. +Inherently, a `ConstraintValidator` may be invoked by multiple threads so please keep that in mind when using them. +You should consider using at least `RequestScoped` validators. === Code Requirements - There are no compile dependencies to use the Bean Validation module. You simply need to override the factory, either in Java: [source,java] ------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------- Validation.byDefaultProvider().configure().constraintValidatorFactory(new CDIAwareConstraintValidatorFactory()).buildValidatorFactory() -------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------- Or in XML: [source,xml] ------------------------------------------------------------------------------------------------------------------------- -:::xml +-------------------------------------------------------------------------------- <validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration"> <constraint-validator-factory>org.apache.deltaspike.beanvalidation.impl.CDIAwareConstraintValidatorFactory</constraint-validator-factory> </validation-config> ------------------------------------------------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- And then you can simply build your `ConstraintValidator`s based on CDI programming rules.
