构造器注入,
@Slf4j
@Component
public class DirectRequestParamHandleFactory {
HashMap<String, DirectRequestParamHandle> serviceCache = new HashMap<>();
public DirectRequestParamHandleFactory(List<DirectRequestParamHandle> directParamHandles) {
for (DirectRequestParamHandle directParamHandle : directParamHandles) {
serviceCache.put(directParamHandle.getBankCode(), directParamHandle);
}
}
}
会把所有的接口实现类放入到list内 (
List<DirectRequestParamHandle>
)
人总得做点什么 ,不是么