`

Java SPI学习

 
阅读更多
public interface Person {
    public void say();
}


public class Teacher implements Person {
    @Override
public void say() {
        System.out.println("我是一名教师!");
    }
}


public class Student implements Person {
    @Override
public void say() {
        System.out.println("我是一名学生!");
    }
}

/resources/META-INF/services/com.zsxq.zsxq.javaspi.Person

com.zsxq.zsxq.javaspi.Teacher
com.zsxq.zsxq.javaspi.Student

实现案例:
DriverManager.getConnection(url, user, password);
dubbo
  • 大小: 216.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics