调用Spring Service并将参数传递给构造函数

时间:2019-11-08 14:41:08

标签: java spring spring-boot

我有这个简单的Spring服务:

@Service
public class BinCountryCheckFilterImpl {

    @Autowired
    private RiskFilterService riskFilterService;

    private Terminals terminal;    

    @Autowired
    public BinCountryCheckFilterImpl(Terminals terminal) {  
        this.terminal = terminal;
    }
}

我想从这里致电服务

@Service
public class FilterProcessing {

    @Autowired
    private BinCountryCheckFilterImpl binCountryCheckFilter; 

    public PaymentResponse someMetohd(Terminals terminal,
              PaymentTransaction message, HttpServletRequest request) throws JAXBException, JsonProcessingException {

        switch(.......) {
            case ".......":
                // send here the args via Contructor
                binCountryCheckFilter.validateBinCountryCheckFilter(terminal);                  
                break;
            case ".........":           
                .........
                break;

                break;                                          
            }           
        }
        return null;
    }
}

但是我不知道如何通过terminal构造函数发送对象BinCountryCheckFilterImpl。 有解决方案吗?

0 个答案:

没有答案