groovy dependencies { compile 'com.google.auto.service:auto-service:1.0-rc2' } package com.example.service; import com.google.auto.service.AutoService; @AutoService(ServiceInterface.class) public class ServiceImpl implements ServiceInterface { } import com.example.service.ServiceInterface; import java.util.ServiceLoader; public class Main { public static void main(String[] args) { ServiceLoader<ServiceInterface> loader = ServiceLoader.load(ServiceInterface.class); for (ServiceInterface service : loader) { } } }


上一篇:
下一篇:
切换中文