Skip to content

Instantly share code, notes, and snippets.

@AnanthaRajuC
Created April 16, 2022 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnanthaRajuC/ef698414a98b328a9450bc29fb89da0a to your computer and use it in GitHub Desktop.
Save AnanthaRajuC/ef698414a98b328a9450bc29fb89da0a to your computer and use it in GitHub Desktop.
Projections for Spring Data REST
package io.github.anantharajuc.springdatarest.model.projection;
import io.github.anantharajuc.springdatarest.model.Person;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.config.Projection;
@Projection(name="idAndFullName", types={Person.class})
public interface IdAndFullName {
Long getId();
@Value("#{target.firstName}"+" "+"#{target.lastName}")
String getFullName();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment