java跨库调用存储_java-调用spring数据其余存储库方法不会返回...

我有存储库“ ClientRepository”:

public interface ClientRepository extends PagingAndSortingRepository {

}

{

"algorithmId" : 1,

"lastNameTxt" : "***",

"firstNameTxt" : "**",

"middleNameTxt" : "**",

"_links" : {

"self" : {

"href" : "http://localhost:8080/clients/1121495168"

},

"client" : {

"href" : "http://localhost:8080/clients/1121495168"

}

}

}

响应具有预期的链接.

当我在另一个控制器中调用存储库继承的方法findOne时

@RestController

public class SearchRestController {

@Autowired

public SearchRestController(ClientRepository clientRepository) {

this.clientRepository = clientRepository;

}

@RequestMapping(value = "/search", method = RequestMethod.GET)

Client readAgreement(@RequestParam(value = "query") String query,

@RequestParam(value = "category") String category) {

return clientRepository.findOne(Long.parseLong(query));

}

}

它回应

{

"algorithmId" : 1,

"lastNameTxt" : "***",

"firstNameTxt" : "**",

"middleNameTxt" : "**"

}

为什么在第二种情况下响应不包含链接?如何使Spring添加他们的响应?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值