It’s recommended to use Lambda instead of the anonymous class, but there are some pitfalls, such as the potential NoClassDefFoundError.
In this post, I will explore this error and how to avoid it. I have two classes, RequiredObject and OptionalObject. The latter one is optional at runtime, and optional dependency is common especially for this framework.