在 java Spring 引导中使用什么代替 "System.out.println"

What to use instead of "System.out.println" in java Spring Boot

@RequestMapping(method=RequestMethod.POST, value= {"/LMSServer/getNoOfDaysOfApplicationBycellNo"} )
@PreAuthorize("hasAuthority('CUSTOMER_MANAGEMENT_R') OR hasAuthority('CUSTOMER_MANAGEMENT_RW')")
public BasicResponce getNoOfDaysOfApplicationBycellNo(@RequestParam(value = "cellNo") long cellNo)
{
    if(LOG.isInfoEnabled()){
        LOG.info("WebClientRestContoller.getNoOfDaysOfApplicationBycellNo--Start");
        LOG.info("Cell NO: "+cellNo);
    }

    BasicResponce authResp = null;
    try {

        Customer fromDB= (Customer) objLMSDAO.getDetailsByCellno(cellNo);
        DaysOfApplicationResponseDTO toSend= new DaysOfApplicationResponseDTO();

        toSend.setCreatedAt(fromDB.getCreatedAt()+"");
        toSend.setUpdatedAt(fromDB.getUpdatedAt()+"");

        toSend.setRequested_Action(true);

        authResp=toSend;    


        } catch (Exception e) {
            e.printStackTrace();
        }

        if(LOG.isInfoEnabled()){
            LOG.info("Returned Response is:");
            LOG.info("Response Requested_Action: {} ",new Object[]{authResp.getRequested_Action()});
            LOG.info("WebClientRestContoller.getNoOfDaysOfApplicationBycellNo--End");
        }

        return authResp;

}

以上是我的主要代码。我想打印天数差异(createdAtupdatedAt 之间的天数)。我在哪里写这个逻辑?我记得在java中我们使用System.out.println来显示输出,但是这里我不知道在Postman上显示代码。

下面是我的 DTO:

public class DaysOfApplicationResponseDTO extends BasicResponce{

private String createdAt;
private String updatedAt;
private String days;


public String getDays() {
    return days;
}

public void setDays(String days) {
    this.days = days;
}
private List<CustomerLoanSummaryResponseDTO> LoanApplicationDummyResponseList;

public String getCreatedAt() {
    return createdAt;
}

public void setCreatedAt(String createdAt) {
    this.createdAt = createdAt;
}

public String getUpdatedAt() {
    return updatedAt;
}

public void setUpdatedAt(String updatedAt) {
    this.updatedAt = updatedAt;
}

public List<CustomerLoanSummaryResponseDTO> getLoanApplicationDummyResponseList() {
    return LoanApplicationDummyResponseList;
}

public void setLoanApplicationDummyResponseList(
        List<CustomerLoanSummaryResponseDTO> loanApplicationDummyResponseList) {
    LoanApplicationDummyResponseList = loanApplicationDummyResponseList;
}

public DaysOfApplicationResponseDTO() {
    super();
}
public DaysOfApplicationResponseDTO(String createdAt, String UpdatedAt, String days,
        List<CustomerLoanSummaryResponseDTO> loanApplicationDummyResponseList) {
    super();
    this.createdAt = createdAt;
    this.updatedAt = updatedAt;
    this.days = days;
    this.LoanApplicationDummyResponseList = loanApplicationDummyResponseList;

}
}

您可以在您的项目中引入服务类(@service注解)用于领域逻辑。您必须将项目分解并组织到合适的项目结构中(以便您的控制器、实体、服务在不同的包中以清楚起见)。更好地阅读这些以获取更多信息。

这是一个有用的堆栈溢出问题,