How do I change the transaction settings for Spring Data repositories globally? -
i'm using spring data application repositories.
interface myuserrepository extends jparepository<myuser, long> { … }
spring data adding transactional repositories default propagation.required
if i'm not mistaken. how can set propagation.mandatory
repositories in aop. don't want set annotation every repository.
idea behind forbid using repositories out of transactional scope used through services. i'm using aop other services not working correctly repositories proxied.
you can create custom repository base interface , annotate settings need:
@norepositorybean @transactional(propagation = propagation.mandatory) public interface baserepository<t, id extends serializable> extends pagingandsortingrepository<t, id> { }
now let of application repositories extend base repository interface , you'll go.
Comments
Post a Comment