i have some standard Spring @Service classes in a separate jar lib that use the standard @Cacheable Spring annotation, in a Spring boot project i declare the dependency, configure a CacheManager and just works!
i try to do the same in a Grails 3.1 project but with no luck! i discover that https://github.com/grails-plugins/grails-cache require to use its 'proprietary' @Cacheable annotation:
http://grails-plugins.github.io/grails-cache/3.0.x/api/grails/plugin/cache/Cacheable.html
As workaround i FORKED some Service just to use the Grails @Cacheable and it's working but i'd like to have a single @Service that works under grails or not!
I have misconfigured something, it doesn't behave the same way, but i can't figure out what is it!
i'd like to share this jar lib between spring only & grails projects, but so far i can't make caching work, unless i forked the service calsses under grails-app/services directory & used 'proprietary' @Cacheable annotation;
i try to remove the plugin and configure the bean and the cache in: /GPsGrails3/grails-app/init/gpsgrails3/Application.groovy with the org.springframework.context.annotation.Bean annotation:
@Primary
@Bean
public ConcurrentMapCacheManager concurrentMapCacheManager() {
return new ConcurrentMapCacheManager();
}
@Bean
public SignatureService signatureService() {
SignatureService _signatureService = new SignatureService();
return _signatureService;
}
i put signatureService under grails-app/services directory: /GPsGrails3/grails-app/services/it/finmatica/ifw/impl/SignatureService.groovy
Maybe i have to configure my beans in: /GPsGrails3/grails-app/conf/spring/resources.groovy ?
i have to use the version 4 of the plugin? compile "org.grails.plugins:cache:4.+"