[英]Java Spring @GetMapping not found
我在一個類中編寫了兩個函數 @GetMapping。 函數 getProcessImage 正在工作,但函數 hello 不工作。
我在一個類中編寫了兩個函數 @GetMapping。 函數 getProcessImage 正在工作,但函數 hello 不工作。 未找到 404。
@GetMapping(value = "/{processInsID}/{containerId}")
public ServiceResponse<String> getProcessImage(@PathVariable("processInsID") long procInstId,
@PathVariable("containerId") String containerId) {
AuthenticationInfo bpmAuthenInfo = new AuthenticationInfo(env.getProperty("jbpm.url"),
env.getProperty("jbpm.username"), env.getProperty("jbpm.password"), "");
String result = jbpmService.getImageProcessInProgess(bpmAuthenInfo, containerId, procInstId);
try {
return new ServiceResponse<String>(Constant.ServiceResponse.CODE_SUCCESS,
Constant.ServiceResponse.MSG_SUCCESS, result);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return new ServiceResponse<String>(Constant.ServiceResponse.CODE_ERROR, e.getMessage(), null);
}
}
@GetMapping(value = "/image/")
public ServiceResponse<String> hello() {
return new ServiceResponse<String>(Constant.ServiceResponse.CODE_ERROR,"okok", null);
}
您需要將 getMapping 更改為 /image (即刪除 / ),或者您需要在 url 路徑中添加 image/。我建議您將代碼中的 / 刪除為 /image
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.