Я использую сервер jpos Q2 с диспетчером транзакций из моего весеннего загрузочного приложения, однако, когда я пытаюсь реализовать DI в своем классе, который реализуется из интерфейса Jpos TransactionParticipant, он дает мне исключение нулевого указателя.
Насколько я понимаю, я перепробовал все варианты, которые могут быть в весенней загрузке для IoC. Кажется, что сторонняя библиотека TransactionParticipant не может зарегистрировать ее в модуле Spring IoC/DI.
package com.fonepay.iso;
@Service("processIsoTxn")
public class ProcessIsoTxn implements TransactionParticipant{
@Autowired
private CbsTxnService cbsTxnService;
@Override
public int prepare(long id, Serializable context) {
Context ctx = (Context) context;
try{
ISOMsg request = (ISOMsg) ctx.get("REQUEST");
//Call local processing Message
//CbsTxnService cbsTxnService = new CbsTxnServiceImpl();
ISOMsg response = cbsTxnService.createFinancialTxn(request);
ctx.put("RESPONSE", response);
return PREPARED;
}catch(Exception ex){
System.out.println("Process Iso Txn | error | "+ex);
}
return 0;
}
}
package com.fonepay.service.impl;
@Service("cbsTxnService")
@Transactional
public class CbsTxnServiceImpl implements CbsTxnService{
public ISOMsg createFinancialTxn(ISOMsg isoMsg) {...}
}
@SpringBootApplication
@ComponentScan("com.fonepay")
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class JposserverApplication {
public static void main(String[] args) {
SpringApplication.run(JposserverApplication.class, args);
}
}
Я постоянно получаю java.lang.NullPointerException в строке ISOMsg response = cbsTxnService.createFinancialTxn(request);