use autowired to fetch freshserviceimpl instance
This commit is contained in:
父節點
2546987df5
當前提交
9e03b00796
@ -60,9 +60,10 @@ public class freshController {
|
||||
}
|
||||
ServletUtil.createSuccessResponse(200, result, response);
|
||||
}
|
||||
@RequestMapping(value = "/updating",method = RequestMethod.POST)
|
||||
|
||||
@RequestMapping(value = "/updating", method = RequestMethod.POST)
|
||||
public void updating(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String oldVersionId = request.getParameter("oldVersionId");
|
||||
ServletUtil.createSuccessResponse(200, GJson.toJson(new refreshServiceImpl().new_version(oldVersionId)),response);
|
||||
}
|
||||
ServletUtil.createSuccessResponse(200, GJson.toJson(new refreshServiceImpl().new_version(oldVersionId)), response);
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class refreshServiceImpl implements refreshService {
|
||||
|
||||
|
||||
freshServiceImpl ser=new freshServiceImpl();
|
||||
@Autowired
|
||||
freshServiceImpl ser = new freshServiceImpl();
|
||||
|
||||
//version1大返回一个正数,小返回一个负数,相等返回0
|
||||
public static int compareVersion(String version1, String version2) throws Exception {
|
||||
@ -35,9 +35,8 @@ public class refreshServiceImpl implements refreshService {
|
||||
|
||||
@Override
|
||||
public fresh new_version(String oldVersion) throws Exception {
|
||||
freshServiceImpl ser=new freshServiceImpl();
|
||||
String newVersion = ser.query().VersionId;
|
||||
if (compareVersion(oldVersion, newVersion) < 0){
|
||||
if (compareVersion(oldVersion, newVersion) < 0) {
|
||||
return ser.query();
|
||||
}
|
||||
return null;
|
||||
|
載入中…
x
新增問題並參考
Block a user