Hello!
I'm not sure that I've chosen the correct forum to ask this question -- sorry for that.
I'm using the @Cacheable annotation on the method and it works well:
This method is described in some MenuProvider interface. Implementation defined in the context file. I'm accessing it like this:Code:@Override @Cacheable("menu") public Menu getFullMenu(Consumer consumer) { // Some expensive work here }
But it does not work when I move the Cacheable annotation to another method like this:Code:Consumer consumer = ...; MenuProvider menuProvider = classPathXmlApplicationContext.getBean("menuProvider", MenuProvider.class); Menu menu = menuProvider.getFullMenu(consumer);
I understand that internal method must be public, but it seems that I missing something else (about AOP or about @Cacheable).Code:@Override public Menu getFullMenu(Consumer consumer) { return getFullMenuInternal(consumer); } @Cacheable("menu") public Menu getFullMenuInternal(Consumer consumer) { // Some expensive work here }
Any ideas?
Regards,
Alexey?


Reply With Quote