繁体   English   中英

未找到 Java Spring @GetMapping

[英]Java Spring @GetMapping not found

我在一个类中编写了两个函数 @GetMapping。 函数 getProcessImage 正在工作,但函数 hello 不工作。

未找到 404

我在一个类中编写了两个函数 @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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM