Skip to content

Instantly share code, notes, and snippets.

@fishyer
Created January 18, 2021 09:03
Show Gist options
  • Save fishyer/c2d46917ccedf3fc7dcc3817216cc2dc to your computer and use it in GitHub Desktop.
Save fishyer/c2d46917ccedf3fc7dcc3817216cc2dc to your computer and use it in GitHub Desktop.
依赖注入-服务管理类-使用示例|-|{"files":{"ServiceFactoryManager.java":{"env":"plain"}},"tag":"Android"}
package com.daigou.sg.app;
import com.daigou.sg.manager.LanguageServiceImpl;
import com.ezbuy.core.error.ErrorConsumer;
import com.ezbuy.core.helper.ServiceFactory;
import com.ezbuy.core.language.LanguageService;
import com.ezbuy.dto.impl.CartPublicServiceImpl;
import com.ezbuy.dto.service.CartPublicService;
/**
* 初始化ServiceFactory,动态注册所有Service
*/
public class ServiceFactoryManager {
public static void init() {
ServiceFactory.registerService(CartPublicService.class, CartPublicServiceImpl.class);
ServiceFactory.registerService(ErrorConsumer.class, ErrorConsumerImpl.class);
ServiceFactory.registerService(LanguageService.class, LanguageServiceImpl.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment