1 Star 10 Fork 12

lzhcode / maven-parent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Application.java 970 Bytes
一键复制 编辑 原始数据 按行查看 历史
lzhcoder 提交于 2019-01-04 20:21 . spi测试代码
package com.lzhsite.spring;
import java.util.ServiceLoader;
import com.lzhsite.spring.web.service.spi.Printer;
/*
测试spi需要引入的配置列表
lzh-spirngboot-openapi/src/main/java/com.lzhsite.spring.web.service.spi.Printer;
lzh-springboot-consoumer/src/main/resources/META-INF/services/com.lzhsite.spring.web.service.spi.Printer
lzh-springboot-provider/src/main/resources/META-INF/services/com.lzhsite.spring.web.service.spi.Printer
<dependency>
<groupId>com.lzhsite</groupId>
<artifactId>lzh-springboot-provider</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lzhsite</groupId>
<artifactId>lzh-spirngboot-openapi</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
*/
public class Application {
public static void main(String[] args) {
ServiceLoader<Printer> printerLoader = ServiceLoader.load(Printer.class);
for (Printer printer : printerLoader) {
printer.print();
}
}
}
Java
1
https://gitee.com/lzhcode/maven-parent.git
git@gitee.com:lzhcode/maven-parent.git
lzhcode
maven-parent
maven-parent
master

搜索帮助