Code Monkey home page Code Monkey logo

simplespi's Introduction

SimpleSPI

android跨模块调用服务管理器

描述

该库的目的是实现跨模块调用服务,利用注解和AOP实现服务自动注册,客户端不需要关注接口的具体实现,只需要调用服务暴露的接口即可。

工程结构

工程有4个module,分别是基础依赖api,业务模块moduleOne和moduleTwo,这里使用client模块对其他业务模块对功能进行调用。 模块

具体效果

效果

使用

  • service库引用 在需要使用服务的模块中引用依赖:
implementation 'com.ldg.serviceprovider:service:1.0.0'
  • service注入插件 在根目录的build.gradle文件中添加
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.ldg.serviceprovider:plugin-inject:1.0.0'
    }
}

然后在可运行的app项目中添加插件:

apply plugin: 'com.ldg.serviceprovider.inject'
  • 示例
  1. 定义一个服务接口 ApiOne ,提供一个 getMgs 方法
  2. 在实现类 ApiOneImpl 上添加注释 @ServiceDeclare(provider = ApiOne.class)
  3. 在调用的地方执行方法: ServiceManager.get(ApiOne.class).getMsg()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.