Guest User

Untitled

a guest
Nov 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import org.springframework.data.repository.PagingAndSortingRepository;
  2. import org.springframework.data.rest.core.annotation.RepositoryRestResource;
  3. import javax.persistence.Entity;
  4. import javax.persistence.Table;
  5. import org.springframework.boot.autoconfigure.SpringBootApplication;
  6. import org.springframework.boot.SpringApplication;
  7. import javax.persistence.GeneratedValue;
  8. import javax.persistence.Id;
  9.  
  10. @Entity
  11. public class Person {
  12. @Id @GeneratedValue @Column Long id;
  13. @Column String name;
  14. @Column Int age;
  15. @Column String occupation;
  16. }
  17.  
  18. @RepositoryRestResource(collectionResourceRel = "people", path = "people")
  19. public interface PersonRestRepository extends PagingAndSortingRepository<Person, Long> {}
  20.  
  21. public class Main {
  22. public static void main(String args []) { SpringApplication.run(Application.class, args); }
  23. }
Add Comment
Please, Sign In to add comment