title: Is it possible to specify property name on projection class in Spring data?
body: <p>So I have following projection class</p>
  
  <pre><code>@Data
  @AllArgsConstructor
  public class CommentDTO3 {
  
      private Long id;
  
      private String comment;
  
      private Long userId;
  
      private Long placeId;
  
      private String userUserProfileFirstName;
  }
  </code></pre>
  
  <p>This works just fine, however I would like to have <code>userUserProfileFirstName</code> property named as <code>comentator_name</code>. Is it possible to do something like this:</p>
  
  <pre><code>@Value("user.userProfile.firstName")
  private String userUserProfileFirstName;
  </code></pre>
  
  <p>I have tested that particular example, but @Value annotation seems to be neglected. 
  I am not interested in using <code>@Query</code> annotation to provide custom constructor.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>This is what works for me:</p>
  
  <pre><code>@JsonProperty("userName")
  private String userUserProfileFirstName;
  </code></pre>
  
  <p>This one works not</p>
  
  <pre><code>@JsonProperty("userName")
  @Value("#{target.user.userProfile.firstName}")
  private String userName;
  </code></pre>
  
  <p>and it fails on startup with :</p>
  
  <pre><code>org.springframework.data.mapping.PropertyReferenceException: No property name found for type User! Traversed path: Comment.user.
  </code></pre>
  
  <p><a href="https://gist.github.com/Antoniossss/7ab00c180013f707ef9a8cdc2d53e807" rel="nofollow noreferrer">https://gist.github.com/Antoniossss/7ab00c180013f707ef9a8cdc2d53e807</a></p>