This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2021-02-19T06:54:36.779Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
事务失效的情况: | |
1.方法不是public | |
2.该类中不带事务的方法调用了事务的方法 | |
3.捕获了异常未抛出 | |
4.不支持事务@Transactional(propagation = Propagation.NOT_SUPPORTED) | |
5.没有配置TransactionManager | |
6.throw new Exception(e.getMessage());事务也是无效的,主要原因是事务回滚的条件是throw 运行时异常(RunTimeException).如果需要其他异常也回滚,需要在@Transactional后面加上rollbackFor或者noRollbackForClassName来指明触发回滚的异常 | |
在捕获的异常中手动回滚: | |
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsch使用秘钥登录sftp出现秘钥解密失败的问题 | |
生成秘钥的Openssl工具版本较高,工程中的jsch版本无法正常使用此版本的秘钥 | |
解决: | |
1.使用低版本的Openssl工具生成自己的秘钥。 | |
2.ssh-keygen -t RSA生成RSA版本的秘钥 |