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就变成了起实现类了
正文到此结束
- 本文标签: Spring Spring Boot
- 本文链接: https://code.jiangjiesheng.cn/article/24
- 版权声明: 本文由小江同学原创发布,转载请先联系本站长,谢谢。