How to build custom @Projections for spring-rest?
<p><code>spring-data-rest</code> makes it possible to expose <code>@Entity</code> domain objects directly and even provide a <code>DTO</code> projection as follows:</p>

<pre><code>@Projection(name = "personDTO", types = { Person.class })
public interface PersonDTO {

  @Value("#{target.firstName} #{target.lastName}") //SPeL
  String getFullName();
}
</code></pre>

<p>Question: what if I want to construct only <em>some</em> of the dto fields myself? Eg having some kind of condition on the firstname field, and fill it based on this either the one or other way. Is that possible?</p>

<p>Spring mentions a example, but unfortunately it's not complete:
<a href="https://spring.io/blog/2014/05/21/what-s-new-in-spring-data-dijkstra" rel="nofollow">https://spring.io/blog/2014/05/21/what-s-new-in-spring-data-dijkstra</a></p>

<pre><code>@Projection(name = "summary", types = Order.class)
interface OrderSummary {
  @Value("#{@shop.calculateTotal(target)}")
  Money getTotal();
}
</code></pre>

<p>Here the logic is exported to <code>@shop.calulcateTotal()</code>, BUT they don't tell in the example how this <code>@shop</code> bean is injected here. I assume this is a  <code>@Service</code>, but don't know how to get it in.</p>