JBoss Community

Custom class loader?

created by Andrea Giovannini in Beginner's Corner - View the full discussion

Hi,
I have an existing J2EE application without any dependency injection, so if class A uses class B then in class A I have

public class A {}
    . . .
    B b = new B();
    b.doSomething();
    . . .
}

and if I want to sobstitute B with C (which extends B) I have to modify class A.
I don't want to modify the entire application but I'd like to intercept class loading in order to replace on the fly class B with class C. Is this possible in JBoss? Can I replace the class loader with a custom one?

Thanks in advance,
Andrea 

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community