Setting Up Annotation Driven Transactions in Spring in @Configuration Class

后端 未结 3 439
盖世英雄少女心
盖世英雄少女心 2021-01-07 21:06

So in the latest version of Spring we are able to use the @Configuration annotation to setup our configurations for Spring. Now in JavaConfig it is possible to

3条回答
  •  时光取名叫无心
    2021-01-07 21:28

    It seems like it isn't possible according to this forum post:

    there may be a more first-class mechanism for enabling annotation-driven TX in @Configuration classes in Spring 3.1, but in the meantime, the recommended approach is to use @ImportResource to include a snippet of XML that declares

    Wait: but you seem to have an XML context anyway. Why not add to it and use @Transactional?

提交回复
热议问题