Java 中的 volatile 和 synchronize 关键字解读
2019-11-17读 Concurrent Patterns and Best Practices,遇到两篇参考文章
- 写于 2001 年的 Double-checked locking: Clever, but broken,对 DCL 实现懒加载单例模式存在的问题进行了深刻的探讨,同时阐述了 synchronize 关键字的作用
- 写于 2018 年的博客 Java Volatile Keyword,详细阐述了 volatile 关键字的作用
一番阅读之后,撰写此文备忘。
Java Html to PDF
2019-10-19百度/必应/谷歌一下,使用 Java 生成 PDF 文档的常用工具为
但是最新的 iText7
使用 AGPL
协议,需要购买 license 才能够合理合法的在商业项目中使用。本着省钱的原则,使用 iText5 进行开发。
Java Bean Validation 及其在 Spring Boot 参数校验中的应用
2019-09-13- 1 ConstraintViolationException 和 MethodArgumentNotValidException 在参数校验中有何区别?
- 2 @Valid 和 @Validated 有什么区别?
- 3 为什么在 Spring Boot 项目中, 各个方法中的
@Valid
注解对 query 参数和 list object 旁边的参数校验注解熟视无睹? - 4 为什么在第 3 条的基础上,只要在 Controller 上打上
@Validated
注解,注解中表明的约束又能焕发新生,起到相应的作用?
Building Web Server With Akka HTTP
2019-07-06Philosophy of Akka HTTP
quoted from their documentations:
The Akka HTTP modules implement a full server and clientside HTTP stack on top of akka-actor and akka-stream. It’s not a web-framework but rather a more general toolkit for providing and consuming HTTP-based services. While interaction with a browser is of course also in scope it is not the primary focus of Akka HTTP.
Akka HTTP was designed specifically as “not-a-framework”, not because we don’t like frameworks, but for use cases where a framework is not the right choice. Akka HTTP is made for building integration layers based on HTTP and as such tries to “stay on the sidelines”. Therefore you normally don’t build your application “on top of” Akka HTTP, but you build your application on top of whatever makes sense and use Akka HTTP merely for the HTTP integration needs.