Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Spring MVC 中,你的一个 Controller 中, 需要调用A service 方法 , 你调用的A service 方法 调用了B service 中的方法C(B service 中的这个方法会抛出一个 NPE) ,假设在 A 中调用 B service C 方法后 你做了对象的保存操作, 请问 Spring 中的事务会不会回滚 ? #55

Copy link
Copy link
@strongant

Description

@strongant
Issue body actions

会抛出异常,因为 NPE 是 RuntimeException 的实例,参考源码:DefaultTransactionAttribute#rollbackOn

@Override
	public boolean rollbackOn(Throwable ex) {
		return (ex instanceof RuntimeException || ex instanceof Error);
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.