# Starter集成方案
应用嵌入AFCenter模式,即集成Strater,应用将AFCenter当做类库嵌入到系统内。
- 开发依赖包
 
    <dependency>
		<groupId>com.primeton.gocom</groupId>
		<artifactId>com.primeton.gocom.afcenter.starter</artifactId>
		<version>8.2.1</version>
	</dependency>
启动类添加com.primeton.components.rest.annotation包扫描
参考代码
@SpringBootApplication @EnableFeignClients @EnableCircuitBreaker @EnableDiscoveryClient @ComponentScan(basePackages = {"com.primeton.components.rest.annotation", " com.primeton.eos.sdkstarterdemo"}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }接口说明
接口文档参考com.primeton.gocom.afcenter.api包与com.primeton.gocom.afcenter.sdk.api包中接口即可。
使用方式
[ ] 调用service接口
直接使用@Autowired 方式注入service接口即可调用对应的API方法。
参考代码
@RestController
@RequestMapping(value = "/demo")
public class TestController {
    @Autowired
    private IDimensionService dimensionService;
    
	@GetMapping("/test/Service")
    public void testService(HttpServletRequest request) {
    	dimensionService.findDimensionIsExist("a", "name");
    }
}
- [ ] 调用sdk接口
 
直接使用@Autowired 方式注入IAFCClient,再get相应API类后再调用对应的API方法。
也可以使用AFCClientFactory去获取IAFCClient
 IAFCClient afcClient=AFCClientFactory.getInstance().createAFCClient();
参考代码
@RestController
@RequestMapping(value = "/demo")
public class TestController {
    @Autowired
    private IAFCClient afcClient;
	@GetMapping("/test/sdk")
    public PageResultList<Role> test(HttpServletRequest request) {
        PageResultList<Role> sysadmin = afcClient.getUserAPI().queryRolesByUserCode("sysadmin", -1, -1, null, null);
        return sysadmin;
    }
}