Discovery 组件用来发现、查找和实现可插入式接口,提供一些一般类实例化、单件的生命周期管理的常用方法。
示例代码:
import org.apache.commons.discovery.DiscoverClass; import org.apache.commons.logging.LogFactory; … DiscoverClass discoverClass = new DiscoverClass(); Class logFactoryClass = (LogFactory)discoverClass.find(LogFactory.class);