short addition @validator-factory: for sure you can use it as well, but not directly as default implementation. (you would have to create a small adapter for it which resolves the @Advanced validator-factory -> delegate to it).
regards, gerhard http://www.irian.at Your JSF/JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2012/9/15 Gerhard Petracek <[email protected]> > hi yaocl, > > you also have to inject and use an @Advanced javax.validation.Validator. > please have a look at [1]. > > regards, > gerhard > > [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage > > http://www.irian.at > > Your JSF/JavaEE powerhouse - > JavaEE Consulting, Development and > Courses in English and German > > Professional Support for Apache MyFaces > > > > > 2012/9/14 YaoCL <[email protected]> > >> Hi >> >> I think the JSF and JPA must use InjectableValidatorFactory to support >> CDIAwareValidator. >> But put the CODI jars into WEB-INF/lib not make the JSF and JPA use >> InjectableValidatorFactory, >> They still use ApacheValidatorFactory. >> >> If I @Inject ValidatorFactory into ManageBean I can get >> InjectableValidatorFactory >> >> @Named >> @RequestScope >> public class PageController { >> @Inject >> @Advanced >> ValidatorFactory validatorFactory; >> >> } >> >> How to replace the default ValidatorFactory? >> >> Regards >> YaoCL >> >> 在 2012-9-14,下午4:26,Yaocl <[email protected]> 写道: >> >> > Hi >> > >> > I have @Advanced on my validator. Is there extra config required for >> CODI? >> > I only copied the jars into WEB-INF/lib folder. >> > >> > >> > @ApplicationScoped >> > @Advanced >> > public class NameUniqueValidator implements >> > ConstraintValidator<NameUnique, String>, Serializable { >> > >> > /** >> > * >> > */ >> > private static final long serialVersionUID = 1L; >> > @Inject >> > private UserService service; >> > >> > @Override >> > public void initialize(NameUnique arg0) { >> > } >> > >> > @Override >> > public boolean isValid(String name, ConstraintValidatorContext >> context) { >> > return service.isNameValid(name); >> > } >> > } >> > >> > Regards, >> > YaoCL >> > >> > On Fri, Sep 14, 2012 at 4:18 PM, Thomas Andraschko <[email protected]> >> wrote: >> >> Hi, >> >> >> >> did you try @Advanced on your validator? >> >> This is required if you did not deactivate it via config. >> >> >> >> Regards, >> >> Thomas >> >> >> >> >> >> 2012/9/14 Yaocl <[email protected]> >> >>> >> >>> Hi >> >>> >> >>> I can't figure out how to make CODI Bean Validation modules work. I >> >>> have a custom constraint require query db. >> >>> I have put all CODI jar files in my WEB-INF/lib folder. But @Inject >> >>> not work in my custom validator. >> >>> >> >>> My java server is TomEE+ 1.1 snapshot. I tried to debug it, Both JSF >> >>> and JPA using default Validator Factory. >> >>> >> >>> Can someone give me a example of using CODI BV module? >> >>> >> >>> >> >>> -- >> >>> YaoCL >> >> >> >> >> >> >
