@Component("spammingAnswerFinder") public class SpammingAnswerFinder implements AnswerFinder { @Cacheable @Override public String findAnswer(String question) { String result = ...; // do some expensive computation and/or I/O return result; } }