Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 05 06:34

    dependabot[bot] on gradle

    (compare)

  • Oct 05 06:34

    xvik on master

    Bump ru.vyarus.java-lib from 2.… Merge pull request #24 from xvi… (compare)

  • Oct 05 06:34
    xvik closed #24
  • Oct 04 23:57
    codecov-commenter commented #24
  • Oct 04 23:56
    codecov-commenter commented #24
  • Oct 04 23:09
    dependabot[bot] labeled #24
  • Oct 04 23:09
    dependabot[bot] opened #24
  • Oct 04 23:09

    dependabot[bot] on gradle

    Bump ru.vyarus.java-lib from 2.… (compare)

  • Sep 09 01:54

    xvik on master

    [Gradle Release Plugin] - new v… (compare)

  • Sep 09 01:54

    xvik on 3.0.1

    (compare)

  • Sep 09 01:54

    xvik on master

    [Gradle Release Plugin] - pre t… (compare)

  • Sep 09 01:50

    xvik on master

    update docs (compare)

  • Sep 09 01:46

    xvik on 2.x

    [Gradle Release Plugin] - new v… (compare)

  • Sep 09 01:46

    xvik on 2.0.1

    (compare)

  • Sep 09 01:46

    xvik on 2.x

    [Gradle Release Plugin] - pre t… (compare)

  • Sep 09 01:43

    xvik on 2.x

    update docs (compare)

  • Sep 08 11:23

    xvik on 2.x

    update build fix Default group manual usage … (compare)

  • Sep 08 10:56

    xvik on master

    fix Default group manual usage … (compare)

  • Sep 07 06:13
    xvik closed #22
  • Sep 07 06:12

    xvik on master

    replace travis with github acti… update gradle add java 16 to ci and 1 more (compare)

serioussam
@serioussam
@xvik do you have any timeline on when you will release v1.2.0
Vyacheslav Rusakov
@xvik
@serioussam released few hours ago
serioussam
@serioussam
Thanks for the quick response, But seems like maven central still has 1.1.0
Vyacheslav Rusakov
@xvik
its already in jcenter and should apear in maven central in few hours
serioussam
@serioussam
Awesome, Thanks!!!
Vyacheslav Rusakov
@xvik
you are welcome
mm its already in central
serioussam
@serioussam
now it works, I was not able to pull 1.2.0 an hour ago
Siva Prasad
@thulaban
I would like use your guice validator for injecting object to constraint validator. Please let me know how to use. I tried to use your guice validator however I was not able to inject object to constraint validator.
Vyacheslav Rusakov
@xvik
You only need to install validator module: install(new ValidationModule());
After that you can annotate any bean class (or method) with @ValidateOnExecution and it will perform validations, for example:
@ValidateOnExecution
public class MyService {
    public void do(@Valid MyModel model) {...}
}
This is explicit approach: extra annotation allows you to explicitly define beans to validate.
There is also implicit way, when custom validation is not required. To use it you need to install install(new ImplicitValidationModule()); (instead of ValidationModule)
In implicit approach, validation annotations are searched in all beans, so it will work like this:
public class MyService {
    public void do(@Valid MyModel model) {...}
}
(no extra annotation)
Vyacheslav Rusakov
@xvik
Implicit mode looks great on the first sight, but It means that guice aop will have to analyze all methods of all guice beans in order to find validation annotations.
This is fast, but on huge project (a lot of beans) it will cause a lot of reflection on startup (I doubt it would significally slow down startup, but you must have a choise to avoid that and be generally warned)
If you have problem with custom validator, then I assume you are initializing validator module with custom validator factory, something like: install(new ValidationModule(yourValidationFactory));
It may happen, for exampe if you use it with dropwiard, wich provides configured validator factory.
Vyacheslav Rusakov
@xvik
Now, suppose you have custom validator with injections.
If you use your validation annotation on method (want to validate method parameters or returning object) then your custom validator will work correctly (inkection will be populated)
But if you use Validator produced by validatorFactory, used for module creation), then injection will not work inside custom validator (pureValidator.validate(something))
Vyacheslav Rusakov
@xvik
The reason is that ValidationModule, could not configure passed validatorFactory, and it "forks" it and configures forked facotry. As a result, original factory remains the same and does not know anything about guice.
First advise: use constructor injection for your custom validator:
public class ComplexBeanValidator implements ConstraintValidator<ComplexBeanValid, ComplexBean> {

    private CustomService customService;

   @Inject
   public ComplexBeanValidator(CustomService customService) {...}
}
This way default constraint validator factory will not be able to create bean and you will prevent not initialized injections proble.
Of course, you will have to use correct validator at that place, but you will know for sure what is the problem.
It might not be your case, but I can't tell more without additional details
Siva Prasad
@thulaban
Thank you so much. I have used ImplicitValidationModule and able to inject to custom validators.