I would like to avoid duplicating my POJOs in a microservices application, so I am wondering if there is a way to do that (like proxying)?
I mean, is there a way for a
"Simple": when there are two services that should be using something common - then the answer is move this code into some form of library and have both services depend on it.
Anything else is most likely a bad idea. The whole idea of micro-services is that service A does not in any form depend on B. And you do not want to get into the reflection game and somehow access internals of another service through some sort of backdoor.
As some comment makes clear: using a library helps to avoid code duplication. The alternative is to willfully copy the "common" parts from service B into service A. This is an option, too.
In that sense: you either re-factor the common parts into a library - or you copy them. Both approaches have their pros and cons. You have to determine what matters most in your environment.