我有两个项目,projectA(spring boot),projectB(spring)
在这两个项目中,我有类似的返回字符串的 API。但是来自projectB API的响应有双引号,而projectA的响应中没有双引号
ProjectA [这是 Spring Boot 项目]
@PostMapping(path = "/tenants/{tenantId}/script/getNormalString")
public String getNormalString(@PathVariable("tenantId") String tenantId,HttpServletRequest httpRequest) {
try {
String uuid = "normalString";
return uuid;
} catch(Exception e) {
logger.error("Error in getNormalString-> {}",e.getMessage(),e);
throw new RestApiException(FAILED_GET,e.getMessage(),e);
}
}
Run Code Online (Sandbox Code Playgroud)
回复
normalString
Run Code Online (Sandbox Code Playgroud)
项目B
@PostMapping(path = "/tenants/{tenantId}/script/getNormalString")
public String getNormalString(@PathVariable("tenantId") String tenantId,HttpServletRequest httpRequest) {
try {
String uuid = "normalString";
return uuid;
} catch(Exception e) {
logger.error("Error in getNormalString-> {}",e.getMessage(),e);
throw new RestApiException(FAILED_GET,e.getMessage(),e);
}
}
Run Code Online (Sandbox Code Playgroud)
回复
"normalString"
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决为什么反应有差异吗?有没有办法发送不带双引号的响应?我尝试使用@Produces("text/plain")但响应仍然没有变化