use autowired to fetch freshserviceimpl instance

This commit is contained in:
juzeon 2021-08-18 18:06:56 +08:00
父節點 2546987df5
當前提交 9e03b00796
共有 2 個檔案被更改,包括 7 行新增7 行删除

查看文件

@ -60,6 +60,7 @@ public class freshController {
} }
ServletUtil.createSuccessResponse(200, result, response); 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 { public void updating(HttpServletRequest request, HttpServletResponse response) throws Exception {
String oldVersionId = request.getParameter("oldVersionId"); String oldVersionId = request.getParameter("oldVersionId");

查看文件

@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class refreshServiceImpl implements refreshService { public class refreshServiceImpl implements refreshService {
@Autowired
freshServiceImpl ser = new freshServiceImpl(); freshServiceImpl ser = new freshServiceImpl();
//version1大返回一个正数小返回一个负数相等返回0 //version1大返回一个正数小返回一个负数相等返回0
@ -35,7 +35,6 @@ public class refreshServiceImpl implements refreshService {
@Override @Override
public fresh new_version(String oldVersion) throws Exception { public fresh new_version(String oldVersion) throws Exception {
freshServiceImpl ser=new freshServiceImpl();
String newVersion = ser.query().VersionId; String newVersion = ser.query().VersionId;
if (compareVersion(oldVersion, newVersion) < 0) { if (compareVersion(oldVersion, newVersion) < 0) {
return ser.query(); return ser.query();