Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.springframework.data.repository.PagingAndSortingRepository;
- import org.springframework.data.rest.core.annotation.RepositoryRestResource;
- import javax.persistence.Entity;
- import javax.persistence.Table;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.boot.SpringApplication;
- import javax.persistence.GeneratedValue;
- import javax.persistence.Id;
- @Entity
- public class Person {
- @Id @GeneratedValue @Column Long id;
- @Column String name;
- @Column Int age;
- @Column String occupation;
- }
- @RepositoryRestResource(collectionResourceRel = "people", path = "people")
- public interface PersonRestRepository extends PagingAndSortingRepository<Person, Long> {}
- public class Main {
- public static void main(String args []) { SpringApplication.run(Application.class, args); }
- }
Add Comment
Please, Sign In to add comment