Skip to content

hashCode

Impact of proxy on equals and hashCode

A lot of frameworks create proxies  to apply aspect oriented programming or the lazy loading pattern. Hibernate for example uses cglib or javasissit to create lazy loading proxies. The famous springframework mainly uses java proxyies created via java.lang.reflect.Proxy.newProxyInstance(ClassLoader, Class<?>[], InvocationHandler) or cglib as well. Therefore it is important to know exactly how proxies work and the impact of proxies on your implementations. Especially when implementing basic methods like equals() and hashCode(). How proxies work A proxy is (like the name implies) not the real object. It is another object with the same interface as the real object. Since it has the same interface it can either delegate all calls to… Read More »Impact of proxy on equals and hashCode

GDPR Cookie Consent with Real Cookie Banner