标签:
package com.vrv.paw.axiswebservices; import org.springframework.web.context.ContextLoader; import org.springframework.web.context.WebApplicationContext; import com.vrv.paw.domain.Area; import com.vrv.paw.service.AreaService; public class AreaWebService {
//这里用的是最笨的方法,用代码实例化 private static WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); AreaService areaService = (AreaService) context.getBean("areaService"); public String getAreaCode(String araeIP) { Area area = areaService.queryAreaByServerIp(araeIP); String areaCode = area != null ? area.getCode() : ""; return areaCode; } }
标签:
原文地址:http://www.cnblogs.com/liaojie970/p/4827610.html