更新时间:2023-09-02 22:37:58
您可以使用带有条件SpEL表达式的@Value
重载投影中的属性-如
You can overload properties in projections using @Value
with conditional SpEL expressions - as in this already answered similar question.
考虑其他替代方法(已经提到的其他方法):
Consider other alternatives (others already mentioned):
Person
<-> Account
)Resource
类型(DTO)(例如,返回PublicPerson
而不是Person
).然后,您可以编写用于添加这些类型的自定义链接和自定义投影的自定义资源处理器.Person
<-> Account
)Resource
type (DTO) depending on on user authorities (e.g. returning PublicPerson
instead Person
). Then you can write custom resource processors for adding custom links and custom projections for these types.另请参阅:spring-data-rest DATAREST-428 .
See also: issue on this subject from spring-data-rest DATAREST-428.