2012/11/30 Umesh Awasthi <[email protected]>: > Hi All, > > I am creating a plugin to enable JSR303 validation, idea is to provide a > generic interface and let user provide which bean Validator they want to > use be it Hibernate Bean Validator or Apache one or any other which follow > specifications. > > I was thinking about what can be best way to inject that provider in my > plugin. > > I checked how Spring's LocalValidatorFactoryBean > <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-context/3.0.0.RELEASE/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java>Class > doing this, they have a default implementation but provide a way to let use > inject there own bean validation provider > > private Class providerClass; > > public void setProviderClass(Class<? extends ValidationProvider> > providerClass) { > > this.providerClass = providerClass; > > } > > What can be possible and best way to achieve this? > I do not want to use any other external API to add extra dependency
You may create a custom interface (BeanValidationManagerProvider) with default implementation base on Apache, this way your plugin will be useable out of the box. User will always have an option to implement their own class and provide desired dependency. Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
