jeudi 9 avril 2015

Use multiple annotations on a method and pass the data

I have two annotations on my method :



@Profiled(tag = "XXX") ( // provided by perf4j
@Cacheable(unless="takesLong") // provided by spring
public String cacheResultsIfTakesLong() {


My aim is to cache the results of cacheResultsIfTakesLong method only if it takes longer than a specified time to execute. Is there a way to pass the execution time, calculated during processing of @Profiled annotation, to be used in 'unless' attribute ?


Aucun commentaire:

Enregistrer un commentaire