Hello there,
I developed my own CacheKeyGenerator, but the basePackage of my application will possibly change a lot.
What I tried yet, is to use @KeyGenerator(name = "${application.basePackage}.dao.support.DaoCacheKeyGenerator"), and to use the Maven Resources Plugin to filter the ${application.basePackage} value, but I can't make it work. Would it be possible to be able to give directly the Class<? extends CacheKeyGenerator> of our custom CacheKeyGenerator instead of its full class name? For example, it would be great to be able to write: @KeyGenerator(clazz = DaoCacheKeyGenerator.class).
You would then just need to modify your annotation as follow, and give a priority order to the name and the clazz attributes (e.g. if both have values, use the name one):
@Target( { ElementType.ANNOTATION_TYPE } )
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface KeyGenerator {
String name();
Class<? extends CacheKeyGenerator> clazz();
Property[] properties() default {};
}
Waiting for your opinion ;)
Chris