天天看点

@WebService注入opfegin

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.support.WebApplicationContextUtils;
  
  
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(requestAttributes.getRequest().getServletContext());
 		XxxxClient xxxClient = ctx.getBean(XxxxClient .class);
 		xxxClient.方法即可