Created
November 16, 2017 12:16
-
-
Save gabfssilva/a3e22761bffde731dcbba5a5a51b165a to your computer and use it in GitHub Desktop.
spring data rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment