Skip to content

内部方法调用解决无法使用事务的问题 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public class FooServiceImpl implements FooService {
@Autowired
private JdbcTemplate jdbcTemplate;

@Autowired
private FooService fooService;


@Override
@Transactional
public void insertRecord() {
Expand All @@ -25,6 +29,7 @@ public void insertThenRollback() throws RollbackException {

@Override
public void invokeInsertThenRollback() throws RollbackException {
insertThenRollback();
// 增加类实例调用内部方法,可以使用内部方法的事务
fooService.insertThenRollback();
}
}