@RestController methods seem to be Transactional by default, Why?

前端 未结 2 1638
天涯浪人
天涯浪人 2021-02-13 17:27

Using Spring boot 1.3.1

I don\'t understand why @RestController are Transactionnal by default. I haven\'t found anything saying so in the docs.

Example which pus

2条回答
  •  孤独总比滥情好
    2021-02-13 17:59

    One-to-one relations are always eagerly fetched. Judging by method names book.getAuthor().getFirstname(), book->author and author->firstName are such relations. LazyInitializationException will only occur for lazy collections.

提交回复
热议问题