在servlet中使用spring注解
@Autowired
IAgreementPayService agreementPayService;
/**
* 支付参数
*/
@Value("B{agreementPay.publicKey}")
private String publicKey;
/**
* 启动初始化上下文
*/
@Override
public void init() throws ServletException {
super.init();
ServletContext application = this.getServletContext();
// 解决servlet用@Autowired自动注入service失败的问题
SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, application);
}