caching - Spring DomainClassConverter Cache -
i'm using spring-data-jpa, , i'm trying apply spring cache abstraction.
findbyemail()
method caches well, however, user variable on retrieve()
method @ controller spring-data-jpa provide domainclassconverter
looks db.
in documentation, calles findone()
resource, @cacheable
trigger won't work.
seems implementation class simplejparepository
invoke crudrepository
instead of userrepository
created , put @cacheable
annotation.
is there way apply @cacheable
findone()
except custom domainclassconverter
class ?
usercontroller.class
@requestmapping(method = requestmethod.get, value = "/users/{user}") public responseentity retrieve(@pathvariable user user) { logger.info("retrieve: " + user); return new responseentity(user.touserresponse(), httpstatus.ok); }
userservice.class
public interface userrepository extends jparepository<user, long>, jpaspecificationexecutor<user> { @cacheable("users") user findone(long id); @cacheable("users") user findbyemail(string email); user findbyemailandpassword(string email, string password); long countbyemail(string email); }
i've filed , fixed datacmns-620 you.
this issue shouldn't occur spring data commons 1.10.0 m1 (fowler) moved spring data rest repositoryinvoker
api explicitly checked custom overrides. created fix 1.9.x bugfix branch fix users of current release train evans.
if want check upgrade spring data commons 1.9.0.build-snapshot or 1.10.0.build-snapshot. if you're using boot, can set property spring-data-releasetrain.version
, set either evans-build-snapshot
or fowler-build-snapshot
.
Comments
Post a Comment