原创

Spring-对象注入方式-构造器

1、通过构造器注入

private final BizzConfig bizzConfig;
private final HttpClientUtil httpClientUtil;
private final PaasServerService paasServerService;
public LoginInterceptor(BizzConfig bizzConfig, HttpClientUtil httpClientUtil, PaasServerService paasServerService) {
this.bizzConfig = bizzConfig;
this.httpClientUtil = httpClientUtil;
this.paasServerService = paasServerService;
}

2、List<interface>

3、注入到map中
@Autowired
private Map<String, interface> tableTlServiceMap;
//String 是service名称,interface就变成了起实现类了


正文到此结束
本文目录