Given the following Java code (from a 3rd-party-library outside of my control):
package some.third.party.lib;
interface MyInterface { ... }
and the following class A with a package-private constructor (this is its only constructor):
package some.third.party.lib;
[...]
class A implements MyInterface {
A() {}
}
ProxyFactoryBean.setTargetName expects the ID of an already instantiated bean. Since my Spring Java Config class is in an application-specific package (and I don't want to change it to some.third.party.lib), I can't instantiate class A, since it's package-private. I'm aware that I could use reflection to temporarily change the visibility of A's constructor, but I would like to avoid this if possible.
Q: (How) can I create a Spring (4.2.1.RELEASE) ProxyFactoryBean of a class A in Spring Java Config without having to use reflection (and without having to put my Java Config Class into the same package as A)?
Please note that when using Spring XML config, this situation does not occur, because Spring (in the background) creates a Bean for class A, probably also using reflection.