![](/img/trans.png)
[英]Getting 403 Response from Spring Boot Rest Service on Raspberry Pi
[英]Spring boot rest service duplicated response body
我正在使用 Spring 引导框架,我的响应返回重复的反向反向。 我正在寻求建议,我该如何解决这种情况?
Controller 端点
@GetMapping("/getPDetailsW/{W}")
public PPreviewW getPDetailsPreviewW(@PathVariable String W) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
String nullCheckBill = "bos";
PPreviewW response = new PromoPreviewWGsm();
PPreviewInfo pPreviewInfo = listRepository.findPByW(W);
log.info(dtf.format(now) + "|getPDetailsPreviewW|" + W+ "|için istek atıldı.");
response.setDisplayId(pPreviewInfo.getDISPLAY_ID());
response.setAccountCode(pPreviewInfo.getACCOUNT_CODE());
if (pPreviewInfo.W!= "bos") {
nullCheckBill = promoPreviewInfo.W;
}
if (nullCheckBill == "bos") {
response.setNEXTFLAG(Boolean.FALSE);
} else {
response.setNEXTFLAG(Boolean.TRUE);
}
return response;
}
我的 Controller class 顶部有 @RestController 注释。
PPreviewW 回复 class
@Getter
@Setter
public class PPreviewW implements Serializable {
public String DisplayId;
public String AccountCode;
}
我正在使用 lombok getters 和 setters
资料库 Class
public PPreviewInfo findPByW(String W) {
PPreviewInfo list = jdbcTemplate
.queryForObject(QueryConstants.GET_P_PREVIEW_INFOW, new Object[]{W}, new PPreviewInfoMapper());
return list;
}
存储库 class 顶部的 @Repository 和 @Autowired 注释。QueryContants 包括我的 sql,它返回正确的大小,例如 XXXX 和 YYYY PPreviewInfo Class
@Getter
@Setter
public class PPreviewInfo {
public String CUSTOMER_ID;
public String BILLING_ACCOUNT_CODE;
}
PPreviewInfoMapper Class
public class PPreviewInfoMapper implements RowMapper<PPreviewInfo> {
@Override
public PPreviewInfo mapRow(ResultSet rs, int i) throws SQLException {
PPreviewInfo pbn = new PPreviewInfo();
pbn.setDISPLAY_ID(rs.getString("DISPLAY_ID"));
pbn.setACCOUNT_CODE(rs.getString("ACCOUNT_CODE"));
return pbn;
}
}
回复
{"DisplayId":"XXXX","AccountCode":"YYYYYY","NEXTFLAG":true,"nextflag":true,"displayId":"XXXX","accountCode":"YYYYYY"}
属性的可见性可能会导致问题,您可以查看将它们更改为私有是否有助于解决问题:
@Getter
@Setter
public class PPreviewW implements Serializable {
private String DisplayId;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.