從標題中的代碼的問題:我應該在哪裏放置@Transactional註解:在接口定義還是在實現類?
@Transactional (readonly = true)
public interface FooService {
void doSmth();
}
public class FooServiceImpl implements FooService {
...
}
VS
public interface FooService {
void doSmth();
}
@Transactional (readonly = true)
public class FooServiceImpl implements FooService {
...
}
大+1順便說一句,我冒昧地把報價做成了一個引號,所以人們不會感到困惑,並且將原文中的斜體等加回來。 – 2010-06-26 06:26:21
@ T.J。 Crowder - 驚人的其他答案如何改變。 thx,NP – 2010-06-26 15:02:17
我已經在Spring docu中閱讀過這條語句,但我仍然不明白爲什麼_transaction設置不會被基於類的代理架構_識別出來?我個人認爲,這只是Spring實現的限制,而不是底層代理基礎架構的問題。 – 2010-09-26 12:53:38