struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <umeshawas...@gmail.com>
Subject Fwd: Preferred Way to Inject Dependency in plugin
Date Sat, 01 Dec 2012 09:17:33 GMT
Any inputs on below mentioned problem?

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




-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message