Added the ability to control the exporting of Repositories, query methods or entity fields by adding "exported = true|false" to the @RestResource annotation.

This commit is contained in:
Jon Brisbin
2012-05-09 09:47:52 -05:00
parent 29c839f5c6
commit e1e460e718
10 changed files with 93 additions and 31 deletions

View File

@@ -98,3 +98,34 @@ This would result in a link value of:
} ]
}
### Hiding certain Repositories, query methods, or fields
You may not want a certain Repository, a query method on a Repository, or a field of your entity to be exported at all. To tell the exporter to not export your these items, annotate them with `@RestResource` and set `exported = false`.
For example, to skip exporting a Repository:
@RestResource(exported = false)
public interface PersonRepository extends CrudRepository<Person, Long> {
}
To skip exporting a query method:
@RestResource(path = "people", rel = "people")
public interface PersonRepository extends CrudRepository<Person, Long> {
@RestResource(exported = false)
public List<Person> findByName(String name);
}
Or to skip exporting a field:
@Entity
@RestResource(exported = false)
public class Person {
@Id @GeneratedValue private Long id;
@OneToMany
@RestResource(exported = false)
private Map<String, Profile> profiles;
}