How to overshadow a class in Java?
Hello!I need to create a test-version of an application.
What I need to do is to create an executable jar with the application but one class needs to be replaced with a testversion of it.
Btw I can not use (I guess what is the plugin pattern) when you provide several classes in the jar that implements a interface and you load the class at runtime for the interface from a
config file. I can not use this pattern since I'm not allowed to provide the original class in the jar.
I tried to create a maven project that depends from the original project. In the new project I created the testversion of the class. But both classes ended up in the jar when I run maven assembly:assembly. And at runtime the orignal class was loaded.
(I thought that the second version would replace the file from the dependency)
Do you guys got any idea of a pattern to apply to fix this?
Best regards
Fredrik