hanweiwei.hashnode.dev·Dec 11, 2025 · 6 min readEnhancing Bean Validation Messages with Spring AOP: Injecting the Original ValueThe Java Bean Validation API (JSR 380, often implemented by Hibernate Validator) provides a robust way to validate data. While the default mechanism for constraint violation messages is adequate, developers often face a common need: including the ori...00
hanweiwei.hashnode.dev·Jun 3, 2025 · 2 min readJava Lambda 表达式1. 背景 Java 8 引入了 Lambda 表达式和函数式接口,其基础技术是 invokedynamic 指令和 LambdaMetafactory 动态类生成机制。相比于传统的匿名内部类和反射,它具有更好的性能和编译器可分析性。(对于编译器跟JVM虚拟机来说,对于确定性的内容更容易优化,比如内联、分支预测、逃逸分析等等) 2. Lambda 是如何被实现的? int num = 10; Runnable r = () -> System.out.println(num);//Lambda语...00
hanweiwei.hashnode.dev·Jun 3, 2025 · 2 min readJava 泛型中的协变与设计原则冲突协变逆变(Covariance and Contravariance: Conflict without a Cause) 设: A 和 B 是类型(types); f 是一个类型变换器(type constructor / type transformation),例如 f(T) = List<T>; ≤ 表示子类型关系(subtyping relation),即 A ≤ B 表示 A 是 B 的子类型(即 A <: B)。 那么: 协变(Covariant):如果 A ≤ B,则...00
hanweiwei.hashnode.dev·May 30, 2025 · 3 min readAnalysis of Covariance in Java Generics and Conflicts with Design PrinciplesIn Java's generic system, covariance refers to the ability to use a subtype generic where a supertype generic is expected, typically expressed through ? extends T. For example: List<? extends Number> numbers = new ArrayList<Integer>(); Covariance ma...00
reason-behind-url-length-limits.hashnode.dev·May 23, 2025 · 5 min readUnderstanding the Reason Behind URL Length LimitsIn web backend development, the idea of limiting URL length is often treated as an arbitrary constraint. However, this limit is deeply rooted in how HTTP requests are structured, how servers process them, and how to protect systems against certain ty...00