javajbossejb

Finding all Java beans that implement a particular interface


I've been trying to write an EJB that scans the JBoss server that it is running on and comes up with a list of all available classes that implement a particular interface. This is easy in C# and I've seen a few examples in Java. However, the Java examples are designed for use in an Application container. I need something that works on JBoss.

I've tried playing with enumerating all available EJBs and haven't been able to make it work. Can anyone help me with this?

Thanks, Avi


Solution

  • You might find this library useful http://code.google.com/p/reflections/

    Using Reflections you can query your metadata such as: