Quarkus有實做Microprofile規範的容錯處理(採用SmallRye)
Spring Cloud以前會使用Netflix Hystrix的方案,但是Hystrix已經停止開發了(只維護)
SpringCloud在2020之後的版本也已經移除spring-cloud-netflix,改推薦使用Resilience4j
Microprofile Fault Tolerance的規格
https://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1.2/microprofile-fault-tolerance-spec.html
Spring和MicroProfile解決方案比較表
https://www.eclipse.org/community/eclipse_newsletter/2019/september/microprofile.php
2022年3月3日 星期四
微服務的容錯處理規範:Microprofile Fault Tolerance
2021年3月2日 星期二
Cookie的setHttpOnly()和setSecure()
https://openhome.cc/Gossip/ServletJSP/Cookie.html
https://ajoshow.com/2017/07/19/201707192223/
Spring設定
https://www.itread01.com/content/1558404302.html
public class MainWebAppInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext sc) throws ServletException {
sc.getSessionCookieConfig().setHttpOnly(true);
sc.getSessionCookieConfig().setSecure(true);
}
}
2020年8月20日 星期四
SpringBootCodeGenerator
https://github.com/moshowgame/SpringBootCodeGenerator
√基于SpringBoot2+Freemarker的代码生成器,
√支持mysql/oracle/pgsql三大数据库,
√用DDL-SQL语句生成JPA/JdbcTemplate/Mybatis/MybatisPlus/BeetlSQL相关代码
ref:
https://zhengkai.blog.csdn.net
2020年8月5日 星期三
@Transactional(rollbackFor = Exception.class)
因為Spring的設計之初參考EJB,預設只會對unchecked exceptions去rollback,如果自己開發的程式對自訂Business Exception(比如傳入的訂單金額為負數)需要RollBack,需要用annotation方式設定@Transactional(rollbackFor = Exception.class),對checked exceptions也rollback。
Although EJB container default behavior automatically rolls back the transaction on a system exception (usually a runtime exception), EJB CMT does not roll back the transaction automatically on anapplication exception (that is, a checked exception other than
java.rmi.RemoteException). While the Spring default behavior for declarative transaction management follows EJB convention (roll back is automatic only on unchecked exceptions), it is often useful to customize this behavior.ref:
2020年6月12日 星期五
重试机制!java retry(重试) spring retry, guava retrying 详解
https://juejin.im/post/5b6ac0a06fb9a04f8a21b192
備用URL: https://mp.weixin.qq.com/s/yhYpbVd3pYi4DByRAlfCgQ
spring-retry 和 guava-retry 工具都是线程安全的重试,能够支持并发业务场景的重试逻辑正确性。
spring-retry:
org.springframework.retry.support.RetryTemplate
https://github.com/rholder/guava-retrying
https://github.com/houbb/sisyphus
支持 fluent 过程式编程
无缝接入 spring
解决 spring-retry 与 guava-retrying 中的不足之处
備用URL: https://mp.weixin.qq.com/s/yhYpbVd3pYi4DByRAlfCgQ
spring-retry 和 guava-retry 工具都是线程安全的重试,能够支持并发业务场景的重试逻辑正确性。
spring-retry:
org.springframework.retry.support.RetryTemplate
https://github.com/rholder/guava-retrying
https://github.com/houbb/sisyphus
支持 fluent 过程式编程
无缝接入 spring
解决 spring-retry 与 guava-retrying 中的不足之处
訂閱:
文章 (Atom)