Declarative transactions (@Transactional) doesn't work with @Repository in Spring

前端 未结 3 1363
感情败类
感情败类 2020-12-10 16:03

I\'m trying to make simple application using Spring, JPA and embedded H2 database. Recently I\'ve come across this strange issue with declarative transactions. They just doe

3条回答
  •  情书的邮戳
    2020-12-10 16:25

    The @Transactional annotation may be placed before an interface definition, a method on an interface, a class definition, or a public method on a class. However, please note that the mere presence of the @Transactional annotation is not enough to actually turn on the transactional behavior - the @Transactional annotation is simply metadata that can be consumed by something that is @Transactional-aware and that can use the metadata to configure the appropriate beans with transactional behavior. In the case of the above example, it is the presence of the element that switches on the transactional behavior.

    from spring doc http://static.springsource.org/spring/docs/2.0.8/reference/transaction.html

提交回复
热议问题